function image_access_test_hidden_entity_field_access

Same name in other branches
  1. 9 core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module \image_access_test_hidden_entity_field_access()
  2. 8.9.x core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module \image_access_test_hidden_entity_field_access()
  3. 11.x core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module \image_access_test_hidden_entity_field_access()

Implements hook_entity_field_access().

File

core/modules/image/tests/modules/image_access_test_hidden/image_access_test_hidden.module, line 16

Code

function image_access_test_hidden_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) {
    if ($field_definition->getName() == 'field_image' && $operation == 'edit') {
        return AccessResult::forbidden();
    }
    return AccessResult::neutral();
}

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