Including parent item in the menu
harhoo - May 29, 2009 - 18:49
| Project: | Menu block |
| Version: | 6.x-2.2 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
How can I extend the functionality to include the parent item in the menu?
If my Primary Links menu is
-Foo1
--Bar1
--Bar2
etc. then setting the menu to Primary Links, the item to and starting level to 2 then when I go to Foo1 the menu is
Bar1
Bar3
when I'd like
Foo1
Bar1
Bar2
This seems to be the way the Druaplcon site works at http://paris2009.drupalcon.org/aboutus - do I have to manually add in an entry for Foo1 to the menu so it's
-Foo1
--Foo1
--Bar1
--Bar2
or is there a better way?

#1
I couldn't see any way to do that either without setting the block title, which I see as error prone.
Attached is a patch with my solution
Cool module
#2
Sorry for the newbie question: To which file is the patch supposed to be applied?
#3
hefox,
I tried to implement your patch, but could not get it to work. Instead,
when at
Parent
of
Parent
--Child1
--Child2
all I saw was
--Child1
--Child2
Is there a setting that needs to be set so that only
Parent
--Child1
--Child2
can be seen? I don't want to see all the other Parent links, jut the Parent link that is active, and its children in a sidebar.
Thanks for your help.
#4
I got this patch to work fine (rolled against the current release 6.x-2.2), although needed to check the
Expand children: > Expand all the sub-menus of this treeoption to get it to work as planned; I also set starting level to '1st with parent' (which is the option the patch adds) and Maximum depth to 2.This is a really useful addition to menu block and I have suggested that this code should be reviewed. Hopefully this functionality will make it into a future release of the module.
Thanks @hefox
#5
Thanks @hefox
i got this to work perfectly for one of my menus. exactly what i was looking for.
it would be great to be able to choose 2nd level with parent!
anyone know how to do that?
#6
hefox, et. al,
The patch does work, sorry for the confusion. Though, I did misinterpret what I though the patch was going to do.
I am looking for what alburton I think is suggesting by "2nd level with parent."
That is, show a second level link and only the parent it is connected to, not all the other menu items at the parent's level.
For example
If I click on Parent1 (or any of its children), I see:
Parent1
--child1
--child2
--child3
and not
Parent1
--child1
--child2
--child3
Parent2
Parent3
Parent4
#7
Maybe you could use the cool new features in -dev : #345419: Add option for menu title as link.
Since John committed the solution above, I don't think patches in that issue could be committed.