function menu_position_page_delivery_callback_alter in Menu Position 7.2
Same name and namespace in other branches
- 7 menu_position.module \menu_position_page_delivery_callback_alter()
Implements hook_page_delivery_callback_alter().
This is the only hook that occurs after the page callback, but before hook_page_build (when blocks are added). We're using this hook for its timing, not its data.
1 call to menu_position_page_delivery_callback_alter()
- menu_position_panels_pre_render in ./
menu_position.module - Implements hook_panels_pane_content_alter().
File
- ./
menu_position.module, line 24 - Provides menu links for dynamic positioning of nodes based on configurable rules.
Code
function menu_position_page_delivery_callback_alter() {
// Don't evaluate the rules twice.
$evaluated =& drupal_static(__FUNCTION__, FALSE);
if ($evaluated) {
return;
}
$evaluated = TRUE;
// Build a small context.
$context = array(
'path' => $_GET['q'],
'entity_type' => NULL,
'bundle_name' => NULL,
);
// Determine what kind of entity page this is.
list($arg0, $arg1, ) = explode('/', $context['path'] . '//');
if ($arg0 == 'node' && is_numeric($arg1)) {
$context['node'] = node_load($arg1);
// Don't evaluate the rules on a 404 page.
if (!$context['node']) {
return;
}
$context['entity_type'] = 'node';
$context['bundle_name'] = $context['node']->type;
}
elseif ($arg0 == 'user' && is_numeric($arg1)) {
$context['user'] = user_load($arg1);
// Don't evaluate the rules on a 404 page.
if (!$context['user']) {
return;
}
$context['entity_type'] = 'user';
$context['bundle_name'] = 'user';
}
menu_position_evaluate_rules($context);
}