You are here

function hook_event_dispatcher_entity_access in Hook Event Dispatcher 8

Implements hook_entity_access().

6 calls to hook_event_dispatcher_entity_access()
EntityAccessEventTest::testEntityAccessEventAllowedResult in tests/src/Unit/Entity/EntityAccessEventTest.php
EntityAccessEvent with allowed result test.
EntityAccessEventTest::testEntityAccessEventCombinedResults in tests/src/Unit/Entity/EntityAccessEventTest.php
EntityAccessEvent with combined results test.
EntityAccessEventTest::testEntityAccessEventForbiddenResult in tests/src/Unit/Entity/EntityAccessEventTest.php
EntityAccessEvent with forbidden result test.
EntityAccessEventTest::testEntityAccessEventNeutralResult in tests/src/Unit/Entity/EntityAccessEventTest.php
EntityAccessEvent with neutral result test.
EntityAccessEventTest::testEntityAccessEventWithDeprecatedSetAccessResult in tests/src/Unit/Entity/EntityAccessEventTest.php
EntityAccessEvent with deprecated setAccessResult test.

... See full list

File

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

Code

function hook_event_dispatcher_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {

  /** @var \Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManagerInterface $manager */
  $manager = \Drupal::service('hook_event_dispatcher.manager');
  $event = new EntityAccessEvent($entity, $operation, $account);
  $manager
    ->register($event);
  return $event
    ->getAccessResult();
}