function field_test_boolean_access_denied_entity_field_access

Same name in other branches
  1. 9 core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module \field_test_boolean_access_denied_entity_field_access()
  2. 10 core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module \field_test_boolean_access_denied_entity_field_access()
  3. 11.x core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module \field_test_boolean_access_denied_entity_field_access()

Implements hook_entity_field_access().

File

core/modules/field/tests/modules/field_test_boolean_access_denied/field_test_boolean_access_denied.module, line 16

Code

function field_test_boolean_access_denied_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
    return AccessResult::forbiddenIf($field_definition->getName() === \Drupal::state()->get('field.test_boolean_field_access_field'));
}

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