EntityTypeListenerInterface.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php
  3. 10 core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php

Namespace

Drupal\Core\Entity

File

core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php

View source
<?php

namespace Drupal\Core\Entity;


/**
 * Defines an interface for reacting to entity type creation, deletion, and updates.
 */
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);

}

Interfaces

Title Deprecated Summary
EntityTypeListenerInterface Defines an interface for reacting to entity type creation, deletion, and updates.

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