function comment_field_storage_config_insert

Same name in other branches
  1. 9 core/modules/comment/comment.module \comment_field_storage_config_insert()
  2. 8.9.x core/modules/comment/comment.module \comment_field_storage_config_insert()
  3. 11.x core/modules/comment/comment.module \comment_field_storage_config_insert()

Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.

File

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

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

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