You are here

public function EditEntityFieldAccessCheck::accessEditEntityField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/quickedit/src/Access/EditEntityFieldAccessCheck.php \Drupal\quickedit\Access\EditEntityFieldAccessCheck::accessEditEntityField()

Checks access to edit the requested field of the requested entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

string $field_name: The field name.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides EditEntityFieldAccessCheckInterface::accessEditEntityField

1 call to EditEntityFieldAccessCheck::accessEditEntityField()
EditEntityFieldAccessCheck::access in core/modules/quickedit/src/Access/EditEntityFieldAccessCheck.php
Checks Quick Edit access to the field.

File

core/modules/quickedit/src/Access/EditEntityFieldAccessCheck.php, line 48
Contains \Drupal\quickedit\Access\EditEntityFieldAccessCheck.

Class

EditEntityFieldAccessCheck
Access check for editing entity fields.

Namespace

Drupal\quickedit\Access

Code

public function accessEditEntityField(EntityInterface $entity, $field_name) {
  return $entity
    ->access('update', NULL, TRUE)
    ->andIf($entity
    ->get($field_name)
    ->access('edit', NULL, TRUE));
}