You are here

function hook_event_dispatcher_entity_field_access in Hook Event Dispatcher 8

Implements hook_entity_field_access().

1 call to hook_event_dispatcher_entity_field_access()
EntityFieldAccessEventTest::testEntityFieldAccessEvent in tests/src/Unit/EntityField/EntityFieldAccessEventTest.php
Test the BlockBuildAlterEvent.

File

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

Code

function hook_event_dispatcher_entity_field_access($operation, FieldDefinitionInterface $fieldDefinition, AccountInterface $account, FieldItemListInterface $items = NULL) {

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