You are here

protected function EasyEmailStorage::invokeHook in Easy Email 2.0.x

Same name and namespace in other branches
  1. 8 src/EasyEmailStorage.php \Drupal\easy_email\EasyEmailStorage::invokeHook()

Invokes a hook on behalf of the entity.

Parameters

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

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

Overrides ContentEntityStorageBase::invokeHook

File

src/EasyEmailStorage.php, line 132

Class

EasyEmailStorage
Defines the storage handler class for Email entities.

Namespace

Drupal\easy_email

Code

protected function invokeHook($hook, EntityInterface $entity) {
  parent::invokeHook($hook, $entity);
  $event_class = $this->entityType
    ->getHandlerClass('event');
  if ($event_class) {
    $this->eventDispatcher
      ->dispatch($this
      ->getEventName($hook), new $event_class($entity));
  }
}