You are here

function hook_event_dispatcher_entity_operation in Hook Event Dispatcher 8

Implements hook_entity_operation().

1 call to hook_event_dispatcher_entity_operation()
EntityOperationsTest::testEntityOperation in tests/src/Unit/Entity/EntityOperationsTest.php
EntityOperationEvent test.

File

./hook_event_dispatcher.module, line 264
Hook event dispatcher module.

Code

function hook_event_dispatcher_entity_operation(EntityInterface $entity) {

  /** @var \Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManagerInterface $manager */
  $manager = \Drupal::service('hook_event_dispatcher.manager');
  $event = new EntityOperationEvent($entity);
  $manager
    ->register($event);
  return $event
    ->getOperations();
}