Convert primary and secondary menus to blocks
kika - June 27, 2009 - 10:18
| Project: | Drupal |
| Version: | 8.x-dev |
| Component: | theme system |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | d7uxsprint, Usability |
Description
This is a placeholder issue to start working on converting primary and secondary menus to blocks.
Usability use case: http://sprint.drupalusability.org/content/main-menu-can-show-two-places
Background: http://hojtsy.hu/blog/2009-apr-09/mission-improve-page-regions-drupal-7 :
"3. Special main and secondary menu display of themes. Again, these are *already blocks*. Themes can just theme them differently when they are in their designated regions. Again, less theme settings, more visibility control, being able to swap menus in sections of the sites via other menu blocks, and so on."

#1
Fixing title
#2
I think this is a bad idea. The whole concept of primary and secondary menus should go. It is a theme setting, and should be a theme option.
Also note that secondary menus can appear as child menu (below) the primary menu. This is a feature that's not possible with this solution. I agree that this whole feature should be scrapped, but you need to be aware it exists as themes must be changed to support this removal.
#3
Here's start on removing this feature. Removed from everywhere I could find, CNR for the test bot.
#4
The proposal:
- Primary links (now called just a block "Main menu") should support 2 level tabbed navigation out of the box. No more super-confusing tricks under "Source for the Main links" and "Source for the secondary links" settings under Menu settings. (there is an initiative to fix that page #503778: Global Menu settings are confusing but is is pretty hopeless). Also part of this is upcoming patch is to move default node/add menu selection setting under content type editing.
- Secondary links: it's an open question what do do with them. Depreciate? Latest D7 replaced "Source for the secondary links" with user links so they are out or user's "visual radar"
- What about upgrade path?
#5
putting status back
#6
Forgot about user links being in the secondary links. Back to CNW - need to sort those out somehow if we do this.
#7
This is how it would structurally work (screenshot attached).
A design decision:
1. we keep link sourcesettings admin/build/menu/settings for now (fixing it in followups), just renaming them to
"Source for primary links" -> "Source for main menu block"
"Source for secondary links" -> "Source for secondary menu block"
#8
Added shot.
Another design decision: we always pass all the menu items inside blocks -- any depth -- to a page_alter() and theme layer.
We theme "Primary links" theme region so it nicely supports two levels of tabs, if you have 3+ depth menu in "Primary links" region, you will need a theme what supports it or nicemenu module
#9
A big +1 on this. It's a huge source of confusion for newbies ("why do i have two primary menus?") and is more consistent with the way other 'special' elements like mission and footer_message are also becoming blocks in D7.
So do these blocks have titles off by default?
#10
Correct, no titles.
#11
This is great, should simplify things a little more and make it easier to move menus around the site.
#12
Makes a lot of sense to me. Converting the menus to blocks removes special casing (improving usability) and is more flexible. It also dovetails nicely with #351249: Finer control over the Parent Menu select box. The combination of these two patches would allow for the removal of the confusing menu settings page.
#13
We might need to look at #511284: Add html_top and move the admin toolbar into html_top implementation.
#14
This is an updated patch.
Removed from everywhere I could find the main and secondary links feature. (mostly from the patch in #3)
(In Garland) Created a 'navigation' region via garland.info (Do I need to add regions[page_top] & regions[page_bottom] explicitly as I did?).
(In Garland) Put 'main menu block' inside the newly created 'navigation' region. Via system.install
(In Garland) Put 'secondary menu block' inside the 'footer' region. Via system.install
(In Garland) Whatever menu block you put inside the 'navigation' region is styled like primary links in D6 and supports two levels menu out of the box. Second level menus are styled like the secondary links in D6. You can assign more than menu block to the navigation region. They won't break but live side by side.
(In Garland) Whatever menu block you put inside the 'footer' navigation is styled horizontally and supports two levels menu.
Notes:
I had to modify Garland CSS to have this working but I haven't been able to test this modification in IE on windows (especially IE6).
Let me know if you like this approach and have a look at the code.This is my first big patch. I'm pretty sure I'm missing something huge. Be kind.
#15
These are some (hopefully) explanatory screenshots.
#16
How long does it take to have a patch tested from the testbot? I posted the patch on February 1st. I wonder if there's something wrong in the patch...
#17
It seems testbot is having problems, not your fault.
#18
The last submitted patch, primarymenu.patch, failed testing.
#19
1104 fails! Wow! It was better when the testbot didn't work. I guess I'll have to browse the documentation to understand what all those fails mean.
Anyhow I won't be able to bring home this patch alone. Is there anybody out there willing to review, at least the approach taken?
#20
As far as I can tell this is Drupal 8 material, we're only fixing bugs for D7 now, not changing/reworking features anymore.
#21
I don't see it as a new feature and it does not change API, so this seems as D7 material to me.
Edit : forgot the "not", uh.
#22
.
#23
People are already porting themes to Drupal 8, and those almost invariably use the primary and secondary links variables, so it's an API change for themers, if not for module developers. So also think this is Drupal 8 now - although it should go in really, really early if at all possible since these are now even more inconsistent with other template variables now that help and mission have been moved to blocks.