1 layout.pages.inc | layout_page_callback() |
Menu callback; Generic page callback for all Layout-provided pages.
File
- core/
modules/ layout/ layout.pages.inc, line 10 - Page callbacks for non-administrative pages of Layout module.
Code
function layout_page_callback() {
$args = func_get_args();
$menu_item_name = array_shift($args);
$menu_item = layout_menu_item_load($menu_item_name);
// Determine the correct layout to use at this path.
$router_item_path = $menu_item->path;
if (strpos($router_item_path, '%') !== FALSE) {
$router_item_path = current_path();
}
$router_item = menu_get_item($router_item_path);
$layout = layout_get_layout_by_path(NULL, $router_item, TRUE);
// No layouts match based on conditions.
if (!$layout) {
return MENU_NOT_FOUND;
}
// Use the selected layout and render it.
$renderer = layout_create_renderer($layout->renderer_name, $layout);
return $renderer->render();
}