You are here

public function QuickEditEntityFieldAccessCheck::access in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck::access()
  2. 9 core/modules/quickedit/src/Access/QuickEditEntityFieldAccessCheck.php \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck::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/QuickEditEntityFieldAccessCheck.php, line 32

Class

QuickEditEntityFieldAccessCheck
Access check for in-place 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);
}