function notify_comment_insert in Notify 2.0.x
Same name and namespace in other branches
- 8 notify.module \notify_comment_insert()
 - 7 notify.module \notify_comment_insert()
 - 1.0.x notify.module \notify_comment_insert()
 
Implements hook_comment_insert().
Add tracked newly created unpublished comments to the unpublished queue.
File
- ./
notify.module, line 185  - Hooks for Notify module.
 
Code
function notify_comment_insert(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();
  }
}