This patch adds support to override the usual way of defining primary and secondary links by linking to an admin-defined drupal menu, allowing dynamic definition of secondary links based on which primary link (if any) is active. This allows neat tabby layouts.
This patch also requires a change in specific phptemplate themes because the <li> tag is now set up in the theme engine, so that class attributes such as "collapsed" and "extended" can be set. What was once:
<ul id="primary">
<?php foreach ($primary_links as $link): ?>
<li><?php print $link?></li>
<?php endforeach; ?>
</ul>
Should now be something like:
<ul id="primarylink">
<?php foreach ($primary_links as $link) {
print "$link \n";
} ?>
</ul>
To see this patch in action, see: http://www.principlesproject.com
Comments
Comment #1
joshk commentedBetter patchfile (unified)
Comment #2
Bèr Kessels commentedHey,
Its not about boasting, but I think my approach allows for far more flexibility.
There is a mayor issue holding us back, its a menu-system issue.
However, I managed to get splitted menus that are still aware of eachother, and are aware of the location on the site.
Also, you introduced a rather odd UI. We have discussed this UI issue on the ML and decided to go for an integrated menu system.
Another thing with my patch is that it does not produce nested ULs. That makes designing tabs much, much easier. Chris Messina told me he had working CSS for nested ULs, but all the examples I have seen out there (listamatic et.al.) use non nested tabs. That counts for something.
Patch (sorry rather old one) is attached.
Comment #3
Bèr Kessels commentedI must stress that the abovementioned patch gives you an idea of my approach, and that it even works, but that it is not meant as a patch for Drupal Core as it is!
Comment #4
joshk commentedThese are two different ways to go about it. The patch I've added only affects phptemplate, not menu.module. I think ultimately the idea of what you're proposing here is where we want to get to, but it will probaby have to wait until 4.7 to get into core. In the mean time, maybe I can borrow some of your methodology to improve the patch for PHPTemplate. In particular, I like what you've done with theme_tabs_menu_tree().
I'll bug Chris M about the nested UL issue. I'm happy to go either way.
Comment #5
Bèr Kessels commentedWe just had a conference on IRC.
The summary will have to wayt a little for it is late here, now. The log is attached.
Comment #6
Bèr Kessels commentedSummary:
the proiblem is:
We cannot create menu containers (boxes) from modules.
We cannot fill a container with items from modules etc. because we cannot give a parent Menu ID (PID).
The options put forward, are:
1) Static SQL-population
- No code to write, but requires a good set of defaults not dependent on modules installed
2) new tree
- feels like a kludge, and would have to rewrite a chunk of menu generation algorithms, but wouldn't be too bad to do.
3) menu items define PIDs
- I think this is far out of scope for what could be coded for 4.6.
4) use "navigation" as primary menu
- Requires massive menu restructuring; seems unlikely since we're already in RC, but if it happens the menu code is not
Agreements.
long term solution, the Drupal Way [tm]
We all seem to agree on the PId approach is the way to go, but this needs to be investigated a bit more. A new menu IRC session will be held on this particular topic.
Short term solution, the Drupal Way [tm]
A new module will be created, with APIs that theme-developers can call. No pathces to core will be neccesary for this.
Comment #7
Bèr Kessels commentedThe module is now available in my sandbox.
Please install, add to your theme, test , and give me feedback.
Note tha the module itsef does nothing. You really need to add the functions to your theme.
Bèr
Comment #8
jakeg commentedWhat's the latest with this?
Comment #9
Bèr Kessels commentedit waiting for some magic gnome to popup and help the array and slicing issues.
Comment #10
jakeg commentedI have this great module working for a primary menu link and also secondary menus within those primary menus (the patch above and the primary links module). The primary links are tabs at the top of the page, and secondary links in an 'add block' I called 'In This Section' with code:
This works fine for every page apart from the home page. One of my primary links is to the home page ('/'). Within that 'section' I want the secondary links block to show links to e.g.
- contact us
- about us
- etc
However I expect the home page doesn't register properly with the menu to display these secondary links. I have its path as a solitary forward slash ('/'). Perhaps I should put something else in for its path in the menu?
It would be great if I could get this to work.
Comment #11
Gunny-1 commentedhi jakeg,
I have this great module working for a primary menu link and also secondary menus within those primary menus
I have installed this module from drupal cvs, but no output. Is it required to apply menu_primary_links.patch to get the primary links working?
Comment #12
Bèr Kessels commentedNo,
you must read the code, and add a function call to your theme.
Comment #13
morbus iffPHPTemplate is part of core in 4.7. Moving.
Comment #14
joshk commentedyay 4.7!
closed
Comment #15
moshe weitzman commented