interface EntityTypeListenerInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php \Drupal\Core\Entity\EntityTypeListenerInterface
  2. 10 core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php \Drupal\Core\Entity\EntityTypeListenerInterface
  3. 11.x core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php \Drupal\Core\Entity\EntityTypeListenerInterface

Defines an interface for reacting to entity type creation, deletion, and updates.

Hierarchy

Expanded class hierarchy of EntityTypeListenerInterface

All classes that implement EntityTypeListenerInterface

6 files declare their use of EntityTypeListenerInterface
EntityDefinitionUpdateManagerTest.php in core/tests/Drupal/Tests/Core/Entity/EntityDefinitionUpdateManagerTest.php
EntitySchemaSubscriber.php in core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
EntitySchemaSubscriber.php in core/modules/system/tests/modules/entity_test_update/src/EventSubscriber/EntitySchemaSubscriber.php
EntityStorageSchemaInterface.php in core/lib/Drupal/Core/Entity/Schema/EntityStorageSchemaInterface.php
EntityTestDefinitionSubscriber.php in core/modules/system/tests/modules/entity_test/src/EntityTestDefinitionSubscriber.php

... See full list

File

core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php, line 8

Namespace

Drupal\Core\Entity
View source
interface EntityTypeListenerInterface {
    
    /**
     * Reacts to the creation of the entity type.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type being created.
     */
    public function onEntityTypeCreate(EntityTypeInterface $entity_type);
    
    /**
     * Reacts to the creation of the fieldable entity type.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type being created.
     * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $field_storage_definitions
     *   The entity type's field storage definitions.
     */
    public function onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, array $field_storage_definitions);
    
    /**
     * Reacts to the update of the entity type.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The updated entity type definition.
     * @param \Drupal\Core\Entity\EntityTypeInterface $original
     *   The original entity type definition.
     */
    public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original);
    
    /**
     * Reacts to the update of a fieldable entity type.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The updated entity type definition.
     * @param \Drupal\Core\Entity\EntityTypeInterface $original
     *   The original entity type definition.
     * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $field_storage_definitions
     *   The updated field storage definitions, including possibly new ones.
     * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $original_field_storage_definitions
     *   The original field storage definitions.
     * @param array &$sandbox
     *   (optional) A sandbox array provided by a hook_update_N() implementation
     *   or a Batch API callback. If the entity schema update requires a data
     *   migration, this parameter is mandatory. Defaults to NULL.
     */
    public function onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array &$sandbox = NULL);
    
    /**
     * Reacts to the deletion of the entity type.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type being deleted.
     */
    public function onEntityTypeDelete(EntityTypeInterface $entity_type);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
EntityTypeListenerInterface::onEntityTypeCreate public function Reacts to the creation of the entity type. 4
EntityTypeListenerInterface::onEntityTypeDelete public function Reacts to the deletion of the entity type. 4
EntityTypeListenerInterface::onEntityTypeUpdate public function Reacts to the update of the entity type. 4
EntityTypeListenerInterface::onFieldableEntityTypeCreate public function Reacts to the creation of the fieldable entity type. 4
EntityTypeListenerInterface::onFieldableEntityTypeUpdate public function Reacts to the update of a fieldable entity type. 4

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