EditEntityFieldAccessCheck::accessEditEntityField

public EditEntityFieldAccessCheck::accessEditEntityField(EntityInterface $entity, $field_name)

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

File

core/modules/quickedit/src/Access/EditEntityFieldAccessCheck.php, line 43

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));
}
doc_Drupal
2016-10-29 09:03:33
Comments
Leave a Comment

Please login to continue.