_menu_find_router_path($menu, $link_path)
drupal/includes/menu.inc, line 2221
Find the router path which will serve this path.
$menu The full built menu.
$link_path The path for we are looking up its router path.
A path from $menu keys or empty if $link_path points to a nonexisting place.
| Name | Description |
|---|---|
| Menu system | Define the navigation menus, and route page requests to code based on URLs. |
function _menu_find_router_path($menu, $link_path) {
$parts = explode('/', $link_path, MENU_MAX_PARTS);
$router_path = $link_path;
if (!isset($menu[$router_path])) {
$ancestors = menu_get_ancestors($parts);
$ancestors[] = '';
foreach ($ancestors as $key => $router_path) {
if (isset($menu[$router_path])) {
break;
}
}
}
return $router_path;
}