function panels_page_prepare_fallback_render in Panels 6.2
Prepare the fallback router, update the menu cache with it, then load up our loader item and initiate fallback.
Partially lifted from menu_get_item().
Parameters
object $load:
array $map:
Return value
object $load
1 call to panels_page_prepare_fallback_render()
- _panels_page_master_loader in panels_page/
panels_page.module - Determine the render-time behavior of panels_page.
File
- panels_page/
panels_page.module, line 413 - panels_page.module
Code
function panels_page_prepare_fallback_render(&$load, $map) {
$original_map = arg(NULL, $_GET['q']);
$default_menu = menu_get_item($_GET['q']);
$parts = array_slice($original_map, 0, MENU_MAX_PARTS);
list($ancestors, $placeholders) = menu_get_ancestors($parts);
if (!($router_item = db_fetch_array(db_query_range('SELECT * FROM {panels_page_router_store} WHERE path IN (' . implode(',', $placeholders) . ') ORDER BY fit DESC', $ancestors, 0, 1)))) {
return _panels_page_not_found($load);
}
// FIXME calling _menu_translate would result in an incomplete load
// $map = _menu_translate($router_item, $original_map);
$load->map = $map;
$load->page_arguments = array_merge(menu_unserialize($router_item['page_arguments'], $map), array_slice($map, $router_item['number_parts']));
$load->page_callback = $router_item['page_callback'];
$load->router_item = $router_item;
// If we did not override the default menu callback, stop here.
if ($router_item['page_callback'] != $default_menu['page_callback']) {
return $load;
}
// Fix for lack of the _menu_translate() function. We crib some of that function here.
_menu_check_access($router_item, $map);
// For performance, don't localize an item the user can't access.
if ($router_item['access']) {
_menu_item_localize($router_item, $map);
}
menu_set_item($_GET['q'], $router_item);
return $load;
}