function comment_entity_insert

Same name and namespace in other branches
  1. 8.9.x core/modules/comment/comment.module \comment_entity_insert()
  2. 10 core/modules/comment/comment.module \comment_entity_insert()
  3. 11.x core/modules/comment/comment.module \comment_entity_insert()

Implements hook_entity_insert().

File

core/modules/comment/comment.module, line 301

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.