You are here

public function EditEntityFieldAccessCheck::access 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::access()

Checks Quick Edit access to the field.

@todo Use the $account argument: https://www.drupal.org/node/2266809.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity containing the field.

string $field_name: The field name.

string $langcode: The langcode.

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

Return value

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

File

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

Class

EditEntityFieldAccessCheck
Access check for editing entity fields.

Namespace

Drupal\quickedit\Access

Code

public function access(EntityInterface $entity, $field_name, $langcode, AccountInterface $account) {
  if (!$this
    ->validateRequestAttributes($entity, $field_name, $langcode)) {
    return AccessResult::forbidden();
  }
  return $this
    ->accessEditEntityField($entity, $field_name);
}