class GroupMenuAccess in Group Menu 8
Checks access for displaying menu pages.
Hierarchy
- class \Drupal\groupmenu\Access\GroupMenuAccess implements GroupMenuAccessInterface
Expanded class hierarchy of GroupMenuAccess
File
- src/
Access/ GroupMenuAccess.php, line 14
Namespace
Drupal\groupmenu\AccessView source
class GroupMenuAccess implements GroupMenuAccessInterface {
/**
* {@inheritdoc}
*/
public function menuEditAccess(AccountInterface $account, MenuInterface $menu) {
return \Drupal::service('groupmenu.menu')
->menuAccess('update', $menu, $account);
}
/**
* {@inheritdoc}
*/
public function menuDeleteAccess(AccountInterface $account, MenuInterface $menu) {
return \Drupal::service('groupmenu.menu')
->menuAccess('delete', $menu, $account);
}
/**
* {@inheritdoc}
*/
public function menuItemAccess(AccountInterface $account, MenuLinkContentInterface $menu_link_content = NULL) {
$menus = \Drupal::service('groupmenu.menu')
->loadUserGroupMenus('edit', $account);
if ($account
->hasPermission('administer menu') || !empty($menus)) {
return AccessResult::allowed();
}
return AccessResult::neutral();
}
/**
* {@inheritdoc}
*/
public function menuLinkAccess(AccountInterface $account, MenuLinkInterface $menu_link_plugin = NULL) {
$menus = \Drupal::service('groupmenu.menu')
->loadUserGroupMenus('edit', $account);
if ($account
->hasPermission('administer menu') || !empty($menus)) {
return AccessResult::allowed();
}
return AccessResult::neutral();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupMenuAccess:: |
public | function |
A custom access check for menu delete page. Overrides GroupMenuAccessInterface:: |
|
GroupMenuAccess:: |
public | function |
A custom access check for menu page and add link page. Overrides GroupMenuAccessInterface:: |
|
GroupMenuAccess:: |
public | function |
A custom access check for menu items page. Overrides GroupMenuAccessInterface:: |
|
GroupMenuAccess:: |
public | function |
A custom access check for menu link page. Overrides GroupMenuAccessInterface:: |