Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentHooks.php

function CommentHooks::fieldStorageConfigInsert

Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.

File

core/modules/comment/src/Hook/CommentHooks.php, line 147

Class

CommentHooks
Hook implementations for comment.

Namespace

Drupal\comment\Hook

Code

public function fieldStorageConfigInsert(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');
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal