You are here

private function MenuItemRoleAccessLinkTreeManipulator::checkUrl in Menu Item Role Access 8

Same name and namespace in other branches
  1. 8.2 src/MenuItemRoleAccessLinkTreeManipulator.php \Drupal\menu_item_role_access\MenuItemRoleAccessLinkTreeManipulator::checkUrl()

Check if we need check the access for this item.

Parameters

\Drupal\Core\Config\ImmutableConfig $config: The config from the menu_item_role_access module.

\Drupal\Core\Url $url: The current Url object for the menu item.

Return value

bool Returns TRUE if we need to check access otherwise FALSE.

1 call to MenuItemRoleAccessLinkTreeManipulator::checkUrl()
MenuItemRoleAccessLinkTreeManipulator::menuLinkCheckAccess in src/MenuItemRoleAccessLinkTreeManipulator.php
Checks access for one menu link instance.

File

src/MenuItemRoleAccessLinkTreeManipulator.php, line 207

Class

MenuItemRoleAccessLinkTreeManipulator
Defines the access control handler for the menu item.

Namespace

Drupal\menu_item_role_access

Code

private function checkUrl(ImmutableConfig $config, Url $url) {
  $check_internal = $config
    ->get('overwrite_internal_link_target_access');

  // If we want to check this URL or not.
  $check_url = $check_internal == TRUE ? TRUE : !$url
    ->isRouted();

  // Check the special case of a no link item.
  if ($url
    ->isExternal() === FALSE && $url
    ->isRouted() && $url
    ->getRouteName() == '<nolink>') {
    $check_url = TRUE;
  }
  return $check_url;
}