1.20.x layout.module | layout_provides_path($path) |
Check if a path is provided by Layout module, as in a custom layout path.
Return value
Boolean TRUE if Layout module provides a path, FALSE if another module: specified the path, or NULL if a path does not exist in the system.
File
- modules/
layout/ layout.module, line 1235 - The Layout module creates pages and wraps existing pages in layouts.
Code
function layout_provides_path($path) {
if (empty($path)) {
return FALSE;
}
$result = db_query('SELECT * FROM {menu_router} WHERE path = :path', array(':path' => $path));
$return = NULL;
// If any page callback exists at this path, allow it to trump custom layouts.
foreach ($result as $router) {
if ($router->page_callback == 'layout_page_callback') {
$return = TRUE;
}
else {
$return = FALSE;
break;
}
}
return $return;
}