protected function ReferenceAccessControlHandler::checkFieldAccess in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/src/ReferenceAccessControlHandler.php \Drupal\bibcite_entity\ReferenceAccessControlHandler::checkFieldAccess()
Default field access as determined by this access control handler.
Parameters
string $operation: The operation access should be checked for. Usually one of "view" or "edit".
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.
\Drupal\Core\Session\AccountInterface $account: The user session for which to check access.
\Drupal\Core\Field\FieldItemListInterface $items: (optional) The field values for which to check access, or NULL if access is checked for the field definition, without any specific value available. Defaults to NULL.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
Overrides EntityAccessControlHandler::checkFieldAccess
File
- modules/
bibcite_entity/ src/ ReferenceAccessControlHandler.php, line 63
Class
- ReferenceAccessControlHandler
- Access controller for the Reference entity.
Namespace
Drupal\bibcite_entityCode
protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
$administrative_fields = [
'uid',
'status',
'created',
];
$editing_administative = $operation == 'edit' && in_array($field_definition
->getName(), $administrative_fields, TRUE);
$updating_revision = $operation == 'update' && $field_definition
->getName() === 'revision_id';
if ($editing_administative || $updating_revision) {
return AccessResult::allowedIfHasPermission($account, 'administer bibcite_reference');
}
return parent::checkFieldAccess($operation, $field_definition, $account, $items);
}