You are here

function notify_comment_insert in Notify 1.0.x

Same name and namespace in other branches
  1. 8 notify.module \notify_comment_insert()
  2. 7 notify.module \notify_comment_insert()
  3. 2.0.x notify.module \notify_comment_insert()

Implementation of hook_comment_insert().

Add tracked newly created unpublished comments to the unpublished queue.

File

./notify.module, line 160
Notify module sends e-mail digests of new content and comments.

Code

function notify_comment_insert(Drupal\Core\Entity\EntityInterface $entity) {
  if (!$entity->status->value) {
    \Drupal::database()
      ->insert('notify_unpublished_queue')
      ->fields([
      'nid' => $entity
        ->get('entity_id')
        ->getValue()[0]['target_id'],
      'cid' => $entity
        ->id(),
    ])
      ->execute();
  }
}