logo

Drupal8 node commands

13 Jul 2021

Custom code on comment publish in Drupal 8

Published On: Tue, 07/13/2021 - 16:43

Custom code on comment publish in Drupal 8

If you want to add your custom code on published of comment then we can use hook"hook_comment_update"

"$comment->isPublished()" will check comment in published

For example you want to send mail when comment published or unpublished so you can follow these step

Open your .module file and add the following code, for example your module name is "mymodule" then

 

function mymodule_comment_update…