The hook used (hook_page_delivery_callback_alter) to set menu trails happens after panels renders.

To correct this, I've added a hook_panels_pane_content_alter() which calls the page_delievery_callback_alter function. This is how menu_position module, which also uses hook_page_delivery_callback_alter, handles it so I just copied from that module.

<?php
function menu_trail_by_path_panels_pre_render() {
  menu_trail_by_path_page_delivery_callback_alter();
}
?>

Patch attached.

Comments

krisgraham’s picture

Issue summary: View changes
StatusFileSize
new1.07 KB
krisgraham’s picture

Issue summary: View changes
krisgraham’s picture

Issue summary: View changes
krisgraham’s picture

Title: Menu active trail setting doesn't work for content placed in panels pages. » Menu active trail setting doesn't work for content placed in panels pages
krisgraham’s picture

maxplus’s picture

Hi,

thanks for the patch, but it doesn't work for me....
I'm using panels 7.x-3.4 and ctools 7.x-1.4 ands I used your patch for Menu Trail By Path 7.x-2.x-dev.
My menu is in a mini-panel.

I have a menu item LEVEL1 > LEVEL2 with a path: TEST/node-title.
When I add another node with path TEST/node-title2 the menu LEVEL2 disappears and LEVEL1 is not active anymore...

Do you have any idea what I'm doing wrong?

BillyTom’s picture

The patch works for me, thank you very much.

I don't use it for mini-panels; just for a few regular panels-pages.

I am using Panels 7.x-3.4, ctools 7.x-1.4 and Menu Trail By Path 7.x-2.0

I think this patch should be added to this module.

sill’s picture

Status: Active » Closed (duplicate)

Patch never worked for me. Also, a duplicate of https://www.drupal.org/node/2303693