public function MenuLinkItemList::defaultAccess in Menu Link (Field) 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/Field/MenuLinkItemList.php \Drupal\menu_link\Plugin\Field\MenuLinkItemList::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
- src/
Plugin/ Field/ MenuLinkItemList.php, line 25
Class
- MenuLinkItemList
- Defines a custom menu link item list for better access checking.
Namespace
Drupal\menu_link\Plugin\FieldCode
public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
if ($operation === 'edit') {
return AccessResult::allowedIfHasPermission($account, 'administer menu');
}
return parent::defaultAccess($operation, $account);
}