protected function AnonymousMenuLinkTreeManipulator::menuLinkCheckAccess in footermap: a footer site map 8
Checks access for one menu link instance.
Parameters
\Drupal\Core\Menu\MenuLinkInterface $instance: The menu link instance.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 call to AnonymousMenuLinkTreeManipulator::menuLinkCheckAccess()
- AnonymousMenuLinkTreeManipulator::checkAccess in src/
Menu/ AnonymousMenuLinkTreeManipulator.php - Performs access checks of a menu tree.
File
- src/
Menu/ AnonymousMenuLinkTreeManipulator.php, line 206
Class
- AnonymousMenuLinkTreeManipulator
- Provides an anonymous-based menu link tree manipulator.
Namespace
Drupal\footermap\MenuCode
protected function menuLinkCheckAccess(MenuLinkInterface $instance) {
$access_result = NULL;
if ($this->account
->hasPermission('link to any page')) {
$access_result = AccessResult::allowed();
}
else {
$url = $instance
->getUrlObject();
// When no route name is specified, this must be an external link.
if (!$url
->isRouted()) {
$access_result = AccessResult::allowed();
}
else {
$access_result = $this->accessManager
->checkNamedRoute($url
->getRouteName(), $url
->getRouteParameters(), $this->account, TRUE);
}
}
return $access_result
->cachePerPermissions();
}