Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I'm currently using Panels2 in my Drupal 6 site to do a node-override for a couple node types. The overridden nodes don't seem to respond to Menu Trails settings. If I disable Panels, Menu Trails works as expected for each type.
Would it be possible to allow Menu Trails to set the menu parents and breadcrumbs for Panel Pages that are catching certain node types?
Comment | File | Size | Author |
---|---|---|---|
#21 | menutrails-362065-21.patch | 737 bytes | fuerst |
#18 | menutrails-362065-18.patch | 1.05 KB | fuerst |
#7 | menutrails-362065-2.patch | 642 bytes | pvasener |
#4 | menutrails-362065.patch | 643 bytes | fuerst |
Comments
Comment #1
geraud CreditAttribution: geraud commentedI face this problem in Drupal 5 too.
Actually, I have Menu Trails up and running and I have primary links displayed on node pages.
But when I override a node type with panels, primary links disappear on node pages.
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedIt has to do with incomplete support for hook_nodeapi() in Panels
http://drupal.org/node/364280
The workaround if there is one, would be to replicate what this module does in it's hook_nodeapi() in hook_init() function. Accessing $node is the main issue in regards to hook_init(). I've stopped working on this, since it's low on my priority list. You can see that right now it's is a code workaround for Organic Groups. The same would have to be done for Panels
Comment #3
drewish CreditAttribution: drewish commentedwell panels2 is really broken and is being overhauled for panels 3. so i'd argue against adding any special case code for it.
Comment #4
fuerst CreditAttribution: fuerst commentedNodes overwritten by Panels node_view still have the
node/<nid>
URL internally. You can get the$node
object by callingnode_load()
usingarg(1)
for the nid.The attached patch modifies Menu Trails by loading the $node object in
menutrails_init()
and callingmenutrails_nodeapi()
to let it do the node related stuff.That still applies to node_view overrides only and not to any other Panel page though. That's another interesting and much needed topic.
Comment #5
rburgundy CreditAttribution: rburgundy commentedsubscribing
Comment #6
pvasener CreditAttribution: pvasener commentedI have tested this patch and it corrects the bug on my system.
Comment #7
pvasener CreditAttribution: pvasener commentedJust a small glitch in the patch though (deprecated by-reference parameter). Here is a fixed one.
Comment #8
xmark99 CreditAttribution: xmark99 commentedPatch #7 worked for me. Thank you so much as this was very much needed since I override all of my node views with Panels.
It will be great addition to the next version of Menu Trails, please :)))))))))
Thanks again.
Comment #9
jcisio CreditAttribution: jcisio commentedPatch applies well for 6.x-1.x-dev and works with Panels 3.x.
Comment #10
alexpottPatch #7 worked well for me too - good work!
Comment #11
nedjoYou can get breadcrumbs working by adding the "Node content" pane to your panel and selecting the option to "Treat this as the primary node page", which triggers hook_nodeapi's view op.
Comment #12
fuerst CreditAttribution: fuerst commentedThat's good to know.
You may also use the modul menu_breadcrumb which does not depend on invocation of
hook_nodeapi
because it useshook_init
to set the breadcrumb. If you already use the modul custom_breadcrumbs 6.x-2.0-beta2 you may use it's similar working option called Use the menu structure to set the breadcrumb trail.Comment #13
sunThis may work, but is not a proper fix. It means we would invoke our functionality twice on regular node pages, just because Panels module is installed.
Instead, we need a deeper integration into Panels, resp. Page manager, to invoke our functionality when the full node page view is overridden.
Comment #14
alexpottRe #11.
In addition to the "Treat this as the primary node page" you also need to disable the "no extras" option in the "Node content" pane. Then the menu_trails hook_nodeapi's view op will be triggered then everything seems to work as expected.
Comment #15
jcisio CreditAttribution: jcisio commented#11 and #14 don't work if the content is cached. #7 works as expected.
Comment #16
pelicani CreditAttribution: pelicani commented#7 rocks!!!
I hope y'all figure out the best way to do this.
thanks for the patch.
Comment #17
rapsli CreditAttribution: rapsli commentedI'm the author of power_menu (http://drupal.org/project/power_menu), which is actually doing the same thing as menu trails, with a different UI, that makes the menu the essential part for structering a website. Well obviously I had the same problems and since I took some code of this module I can aswell give something back.
Well, hook_init is not very nice, I think this one here is doing a better and cleaner job:
Comment #18
fuerst CreditAttribution: fuerst commentedThanks a lot! Works well for me, patch for 6.x-1.1 attached.
Comment #19
ayalon CreditAttribution: ayalon commentedI tested patch #18 and this is the best solution and works perfectly.
Should be commited immediately, because we had enough votes and tests.
Comment #20
sunThanks, looks better!
However, we need to adhere to http://drupal.org/coding-standards and http://drupal.org/node/1354
Also:
- The PHPDocBlock description of the hook implementation reads a bit too colloquial; we can shorten that.
- We can remove the @param directives.
- Any comment line should wrap at 80 chars.
Comment #21
fuerst CreditAttribution: fuerst commentedCorrected patch attached. Coder module did not find anything now.
Comment #22
fuerst CreditAttribution: fuerst commentedComment #23
fuerst CreditAttribution: fuerst commentedSorry, wrong status assigned in #22
Comment #24
dreamdust CreditAttribution: dreamdust commented#21 works perfect!
Comment #25
davidwhthomas CreditAttribution: davidwhthomas commentedThanks, was having the same issue, patch #21 fixed it.
Comment #26
ndm CreditAttribution: ndm commentedThanks, patch #21 works exactly as i want
Comment #27
Peter Törnstrand CreditAttribution: Peter Törnstrand commented#21 is not working for me but #7 does. I'm not sure why though, #21 should work. It seems the call to
menutrails_nodeapi
is done with the exact same parameters inhook_ctools_render_alter
andmenutrails_init
.Is this because I'm using Panels Everywhere?
Comment #28
kriskhaira CreditAttribution: kriskhaira commentedThanks, #21 works for me on Drupal 6.19, Panels 6.x-3.7 & Menu Trails 6.x-1.1.
Comment #29
mikeytown2 CreditAttribution: mikeytown2 commentedJust a heads up; I'm now using the same hook in boost as the patch here is proposing.
http://drupal.org/node/453908#comment-3415970
The hook gets passed 1 more variable though;
$handler
is missing from the patch in #21.Comment #30
fuerst CreditAttribution: fuerst commentedThe
$handler
parameter is new since Revision 1.23.2.4 of ctools/includes/context-task-handler.inc. At least for the patch in #21 it is not important to callhook_ctools_render_alter()
without it. Would be good to add it to be API-safe of course.Comment #31
jaydub CreditAttribution: jaydub commented#21 works as advertised, hopefully can be added to a release soon.
Comment #32
anonI cant get this to work.
Im using the "node_view" panel page as my node panel.
My node includes some terms, and I have assigned the terms to the menui tems with "menu trails".
But the meny doesnt apper in the panel.
If I show the first menu level, its ok, but I need to only show the secound and down.
EDIT:
The patch works if we assign the nodes to the meny with a menypost directly.
Comment #33
cray146 CreditAttribution: cray146 commentedsubscribing
Comment #34
hefox CreditAttribution: hefox commentedActive suggests there is no patch to review. It's not clear that the patch was anon's issue so setting it back to RTBC. However, if the patch is bugged, set it needs work, not active.
I personally dislike calling menutrails_nodeapi like that; my preference would be to add a wrapper function with what menutrails_nodeapi does. and have each call that instead. However, I have nothing to do with this issue, just stumbled on it while helping someone in #drupal IRC.
Oh, add a new line after the end so don't see "No new line"
Comment #35
davidwhthomas CreditAttribution: davidwhthomas commentedI found the patch worked but for some reason was removing the node title, only for anon users.
I fixed with an adjustment to the patch to set the title again.
Putting here in case of use to someone else.
DT
Comment #36
plan9 CreditAttribution: plan9 commentedI'm trying to get this to work on a 5.x install. I think the patch at #7 could work but
menutrails_nodeapi($node, 'view', NULL, TRUE);
probably needs to be tweaked for compatibility with 5.x branch.Anyone know how this should be changed?
Comment #37
Hanno CreditAttribution: Hanno commented#21 worked for me, subscribe
Comment #38
Exploratus CreditAttribution: Exploratus commented#21 worked
Comment #39
kiwad CreditAttribution: kiwad commentedPatch in #21 works well.
Could not reproduce "removing the node title, only for anon users" from #35
Comment #40
shawngo CreditAttribution: shawngo commentedPatch #21 worked great!
Comment #41
FiNeX CreditAttribution: FiNeX commentedPatch #21 works fine even with menu_blocks and i18n. Thanks!
Comment #42
dbassendine CreditAttribution: dbassendine commentedPatch #21 works well for me using Panelizer and Menu Trails
Comment #43
dbassendine CreditAttribution: dbassendine commentedQuick note: I can't reproduce the missing title for anon users.