Control access to fields.
This hook is invoked from \Drupal\Core\Entity\Field\Type\Field::access() to let modules grant or deny operations on fields.
string $operation: The operation to be performed. See \Drupal\Core\TypedData\AccessibleInterface::access() for possible values.
\Drupal\Core\Entity\Field\Type\Field $field: The entity field object on which the operation is to be performed.
\Drupal\Core\Session\AccountInterface $account: The user account to check.
bool|NULL TRUE if access should be allowed, FALSE if access should be denied and NULL if the implementation has no opinion.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_entity_field_access($operation, $field, \Drupal\Core\Session\AccountInterface $account) {
if ($field
->getName() == 'field_of_interest' && $operation == 'update') {
return user_access('update field of interest', $account);
}
}