You are here

public function PathFieldItemList::defaultAccess in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php \Drupal\path\Plugin\Field\FieldType\PathFieldItemList::defaultAccess()
  2. 9 core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php \Drupal\path\Plugin\Field\FieldType\PathFieldItemList::defaultAccess()

Contains the default access logic of this field.

See \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess() for the parameter documentation.

Return value

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

Overrides FieldItemList::defaultAccess

File

core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php, line 47

Class

PathFieldItemList
Represents a configurable entity path field.

Namespace

Drupal\path\Plugin\Field\FieldType

Code

public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
  if ($operation == 'view') {
    return AccessResult::allowed();
  }
  return AccessResult::allowedIfHasPermissions($account, [
    'create url aliases',
    'administer url aliases',
  ], 'OR')
    ->cachePerPermissions();
}