function comment_field_storage_config_insert

comment_field_storage_config_insert(FieldStorageConfigInterface $field_storage)

Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.

File

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

Code

function comment_field_storage_config_insert(FieldStorageConfigInterface $field_storage) {
  if ($field_storage->getType() == 'comment') {
    // Check that the target entity type uses an integer ID.
    $entity_type_id = $field_storage->getTargetEntityTypeId();
    if (!_comment_entity_uses_integer_id($entity_type_id)) {
      throw new \UnexpectedValueException('You cannot attach a comment field to an entity with a non-integer ID field');
    }
  }
}

© 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_field_storage_config_insert/8.1.x