[development] Drop-down primary-links

Yannick Warnier ywarnier at beeznest.org
Thu Mar 15 16:01:25 UTC 2007


Le jeudi 15 mars 2007 à 12:55 +0100, Dries Buytaert a écrit :
> On 14 Mar 2007, at 00:59, Yannick Warnier wrote:
> > I was looking around the other day for a theme that would allow
> > drop-down primary-links to show secondary-links. Obviously, no  
> > theme was
> > proposing that and after a few script searches, I think I understood
> > why. Doing that implies that you get all the primary-links *and*
> > secondary-links structure at once, and nothing was in place to do  
> > that.
> 
> The fact that Drupal 5 supports dynamic menu items (menu items that  
> are conditionally generated) makes it difficult/dangerous to do  
> dynamic HTML menus.  If I'm not mistaken, that is already taken care  
> of by the new menu system in Drupal 6.  That should be good news for  
> the people that want "responsive menus".
> 
> Is DHTML menu items something core could support better?  We're  
> working on the menu system now, so feedback and/or patches from the  
> various menu module maintainers, and theme designers, would be  
> welcome.  I'd love to find out, how we can make it easier to make and  
> support "complex menus".

Hi Dries,

Well, the fact that setting a menu to always be expanded makes all
subitems available is something I didn't know, which could be better
documented in the code.

Apart from that, once you have the complete menu structure available as
a PHP variable, you need:
- a set of CSS rules that deal with a "dynamic-menus" class or the like
- a set of JavaScript event handlers that deal with the movement of the
cursor hovering the menus

Apart from that, there's not much to add. Maybe JQuery already has the
set of functions needed to handle the menu hovering bit.

Personnaly, not knowing about the "expanded" option of each primary link
very well, I wrote another function (similar to menu_primary_links(), if
I remember the name well) to actually return the complete hierarchical
structure of all primary and secondary links into one variable that I
could then use to build the structure.

I called it menu_all_primary_links().

Well, I'm just starting with Drupal so I don't really know much and you
can consider this as a lonely brainstorming session (maybe some ideas
but not too tangible).

Yannick

PS: Thanks for the show at FOSDEM Dries, I already knew a bit about
Drupal but it helped me get a bit further, and I really appreciated the
information about the Belgian community (which I hadn't managed to find
clearly on the website).



More information about the development mailing list