public function MenuAdminPerMenuAccess::menusOverviewAccess in Menu Admin per Menu 8
A custom access check for menu overview page.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\Core\Access\AccessResult The access result.
Overrides MenuAdminPerMenuAccessInterface::menusOverviewAccess
File
- src/
Access/ MenuAdminPerMenuAccess.php, line 42
Class
- MenuAdminPerMenuAccess
- Checks access for displaying administer menu pages.
Namespace
Drupal\menu_admin_per_menu\AccessCode
public function menusOverviewAccess(AccountInterface $account) {
if ($account
->hasPermission('administer menu')) {
return AccessResult::allowed();
}
$permissions = $this::getPerMenuPermissions($account);
if ($account
->hasPermission('administer menu') || $permissions) {
return AccessResult::allowed();
}
return AccessResult::neutral();
}