function comment_entity_insert

comment_entity_insert(EntityInterface $entity)

Implements hook_entity_insert().

File

core/modules/comment/comment.module, line 371
Enables users to comment on published content.

Code

function comment_entity_insert(EntityInterface $entity) {
  // Allow bulk updates and inserts to temporarily disable the
  // maintenance of the {comment_entity_statistics} table.
  if (\Drupal::state()->get('comment.maintain_entity_statistics') && 
    $fields = \Drupal::service('comment.manager')->getFields($entity->getEntityTypeId())) {
    \Drupal::service('comment.statistics')->create($entity, $fields);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!comment!comment.module/function/comment_entity_insert/8.1.x