Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Aug 2010 at 11:56 UTC
Updated:
29 Jul 2014 at 18:59 UTC
In D7 we added H2 headings to theme_links because "Headings should be used on navigation menus and any list of links that consistently appears on multiple pages."1.
At the moment the headings for the Main and Secondary menus are hard coded which is OK if those are in fact what you require, if not then its less than idea - the heading should be the name of the source menu so it has meaning in the context of the users site.
Comments
Comment #1
Jeff Burnz commentedmaking title less ambiguous, we are talking about the links here, not the source menus...
Comment #2
Everett Zufelt commentedAgreed.
Comment #3
dman commentedOnce #410646: "Secondary menu" exists but is no longer the default source for the secondary links lands, the pre-render of the menu lists (with their odd headings) will be in one place, and fixing this up will be nice and possible.
I guess by inspecting
variable_get('menu_main_links_source', 'main-menu'), variable_get('menu_secondary_links_source', 'user-menu')?We didn't notice this weirdness before because all the themes (except Stark) visually hid the hard-coded meaningless menu titles with 'element-invisible'. Hooray for accessibility!
Comment #4
Jeff Burnz commentedLooks like this has to be shoved to D8?
Comment #5
David_Rothstein commentedSo the "all in one place" part of #410646: "Secondary menu" exists but is no longer the default source for the secondary links didn't happen; I guess that would have to happen here then, as a prerequisite for doing this sanely? (Or, we could leave it in page.tpl.php and just add more code there; ugly, but effective.)
***
If we try the "all in one place" thing here, note that the previous patch in that issue had created two separate theme variables, but I think that's problematic because that means if you want to alter something you have to alter it twice. We'd probably rather want to do that with "D7-style" delayed rendering, i.e. something like:
Then page templates can do
print render($main_links)but the links can still be altered before rendering by modifying the $variables['main_links']['#links'] array.In fairness, this theming code was done in the page.tpl.php file in D6 also (an argument for pushing to D8?), although not quite as ugly as in D7, and as far as I know the link headings did not exist.
***
Related issue: #698014: Theme settings for main/secondary variables mismatch with menu settings - there I tried making the heading "Main navigation links" as part of an overall terminology change, which at least is an improvement although not as good as doing it dynamically as proposed here.
Comment #6
dman commentedIt's nice to know that there is a tighter way to do that rendering.
print render($main_links)
Would be better than the in-page crud we have now, and is better than my pee-cooked string (d6 style) attempt too
Render ftw!
Comment #7
sunsubscribing
Comment #8
SeanBannister commentedsub
Comment #9
mgiffordI'm all for adding more meaning to the headings. I do think we should be able to fix this in 7, but it sounds like it can come in a maintenance patch to enhance accessibility after release.
Comment #10
David_Rothstein commentedHm. Looking into this more, I'm not so convinced we want to change those headings to be dynamic after all.
Primary/secondary links are just a list of links. They are derived from "skimming" the top set of links off of a menu, but they are not themselves a complete menu. And currently (unlike when a menu is displayed in a block) we never display the menu title to anyone within the primary/secondary links.
So if we start making it display to screen readers, that could have unexpected results. For example, the menu title might be something that only makes sense to administrators and that they never intended or expected an end user to see (!).
The way it is now is indeed confusing, but I think that's just a duplicate of #698014: Theme settings for main/secondary variables mismatch with menu settings. With that issue, we would switch to having the headings say something like "main links" and "secondary links" (rather than "main menu" and "secondary menu") which would accurately describe to screen readers what they are and their relation to the overall site. Currently, the headings are very confusing, but correct - because Drupal 7 is using the phrases "main menu" and "secondary menu" to refer to these links in the admin interface also. I don't think we can fix them in isolation.
Comment #11
mgiffordSounds like a great issue to think through for D8!
Thanks for looking at this with a fresh perspective.
Comment #12
Jeff Burnz commentedD8 indeed, where this may become a moot point if we change everything to blocks - Menu Block in Core or bust :)
Comment #13
Everett Zufelt commentedMarking as duplicate of #1079010: The secondary links heading, "Secondary menu", is wrong
Comment #14
David_Rothstein commentedIt still would be great to do the second thing that was discussed in this issue too (get these hardcoded headings out of the page.tpl.php file and into somewhere where they can be altered more sanely).
I created #1539004: Remove random PHP function calls and logic (other than render() and hide()) from all core tpl.php files as an issue where this could happen.