Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / field / tests / modules / field_test_boolean_access_denied / field_test_boolean_access_denied.module
1 <?php
2
3 /**
4  * @file
5  * Module for testing denying access to boolean fields.
6  */
7
8 use Drupal\Core\Access\AccessResult;
9 use Drupal\Core\Field\FieldDefinitionInterface;
10 use Drupal\Core\Field\FieldItemListInterface;
11 use Drupal\Core\Session\AccountInterface;
12
13 /**
14  * Implements hook_entity_field_access().
15  */
16 function field_test_boolean_access_denied_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
17   return AccessResult::forbiddenIf($field_definition->getName() === \Drupal::state()->get('field.test_boolean_field_access_field'));
18 }