diff --git a/menu_position.module b/menu_position.module index a5d1c3c..0fb8bfc 100644 --- a/menu_position.module +++ b/menu_position.module @@ -5,6 +5,17 @@ */ /** + * Implements hook_panels_pane_content_alter(). + * + * This is a fix for panels users. Panels are rendered before + * hook_page_delivery_callback_alter() is called, so we hook here to + * evaluate our rules before they are rendered. + */ +function menu_position_panels_pre_render($display) { + menu_position_page_preprocess_callback(); +} + +/** * Implements hook_page_delivery_callback_alter(). * * This is the only hook that occurs after the page callback, but before @@ -12,12 +23,18 @@ * timing, not its data. */ function menu_position_page_preprocess_callback() { - $context = array(); - $context['path'] = $_GET['q']; - if (arg(0) == 'node' && is_numeric(arg(1))) { - $context['node'] = node_load(arg(1)); + static $evaluated = FALSE; + + if ($evaluated == FALSE) { + $context = array(); + $context['path'] = $_GET['q']; + if (arg(0) == 'node' && is_numeric(arg(1))) { + $context['node'] = node_load(arg(1)); + } + menu_position_evaluate_rules($context); + + $evaluated = TRUE; } - menu_position_evaluate_rules($context); } /**