| 1 layout.admin.inc | _layout_menu_router_path_exists($path, $layout_name) |
Helper function to determine whether a layout path is an existing menu router path.
Parameters
string $path: The router path.
string|null $layout_name: The name of the layout that is doing the checking.
Return value
bool: TRUE if the path is an existing menu router path and it is not a path that is part of the layout that matches the layout name. FALSE otherwise.
File
- core/
modules/ layout/ layout.admin.inc, line 938 - Admin page callbacks for the Layout module.
Code
function _layout_menu_router_path_exists($path, $layout_name) {
$path_matches = db_query('
SELECT path, page_callback
FROM {menu_router}
WHERE path = :path
', array(':path' => $path))
->fetchAll();
if (!empty($path_matches)) {
if (!empty($layout_name)) {
$layout = layout_load($layout_name);
foreach ($path_matches as $path_match) {
if ($path_match->page_callback == 'layout_path_access' && $layout->getPath() == $path) {
return FALSE;
}
if (!empty($layout->additional_menu_items)) {
foreach ($layout->additional_menu_items as $menu_item) {
if ($menu_item->path == $path) {
return FALSE;
}
}
}
}
}
}
return !empty($path_matches);
}