function ConfigEntityStorage::invokeHook

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::invokeHook()
  2. 8.9.x core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::invokeHook()
  3. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php \Drupal\Core\Config\Entity\ConfigEntityStorage::invokeHook()

Invokes a hook on behalf of the entity.

Parameters

$hook: One of 'presave', 'insert', 'update', 'predelete', or 'delete'.

$entity: The entity object.

Overrides EntityStorageBase::invokeHook

1 call to ConfigEntityStorage::invokeHook()
ConfigEntityStorage::_doCreateFromStorageRecord in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Helps create a configuration entity from storage values.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php, line 321

Class

ConfigEntityStorage
Defines the storage class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

protected function invokeHook($hook, EntityInterface $entity) {
    // Invoke the hook.
    $this->moduleHandler
        ->invokeAll($this->entityTypeId . '_' . $hook, [
        $entity,
    ]);
    // Invoke the respective entity-level hook.
    $this->moduleHandler
        ->invokeAll('entity_' . $hook, [
        $entity,
        $this->entityTypeId,
    ]);
}

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