public function GroupMenuAccess::menuItemAccess in Group Menu 8
A custom access check for menu items page.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
\Drupal\menu_link_content\MenuLinkContentInterface $menu_link_content: Run access checks for this menu item object.
Return value
\Drupal\Core\Access\AccessResult The access result.
Overrides GroupMenuAccessInterface::menuItemAccess
File
- src/
Access/ GroupMenuAccess.php, line 33
Class
- GroupMenuAccess
- Checks access for displaying menu pages.
Namespace
Drupal\groupmenu\AccessCode
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();
}