Hi,

I think it's easy for someone familiar with the code. I need a submenu to have its parent menu entry as its first element. Menu block split is the only module that allows to generate drop-down for the second level (after some CSS/JS transformations of the resulting submenu) but I need parent's entry in secondary menu to let the visitor jump to "all" easily, without re-clicking parent entry in first-level menu which would be less intuitive. Additionaly I need to be able to globally set the displayed name of that first entry in a submenu to a static string (like "all"). Example:

Tree:

  • programs
    • listings
    • reviews
  • patches
  • hardware

Menus:

1st level: [ *programs* | patches | hardware ] (user clicked programs)

2nd level: [ all | listings | reviews ] (all is the same as programs)

If there is no time right now, could anyone point me which function should I modify to inject this extra element to keep up with coding conventions used in project?

If such functionality would be implemented it will be the first module allowing anyone to easily create drop-down for second level. All other fancy modules are focused on supporting jQuery or CSS layouts but when it comes to splitting their maintainers advise to create dozens of menu blocks with different visibility in order to simulate splitting.

Regards,
Paweł

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

siefca’s picture

Status: Needs review » Active

For now I added settings handler to menu_block_split_settings().

siefca’s picture

Ok, got it. Will submit patch soon.

siefca’s picture

Assigned: Unassigned » siefca
Status: Active » Needs review
FileSize
4.63 KB

I've created simple patch that adds support for this feature. It also re-localizes title and/or description if there is a need to do that, using internal Drupal function, if it's available.

There is however one thing that I don't know. Any menu item is keyed by a string consisting of a number, a title and another number. The last one is menu item ID, but the first number? I've put 0 there and it's working, but if it has some meaning that could break something in such scenario I'll appreciate friendly hacks of this patch.

siefca’s picture

Assigned: siefca » Unassigned
FileSize
4.02 KB

Hi,

I'm attaching a fixed patch. The previous one had issues with Taxonomy Display module when menu contained links to taxonomy terms. In such cases the Taxonomy Module handles link titles generation through registered 'title callback' hook. The callback requires that its argument will be taxonomy term object, which conflicted with applied translation function (from Drupal menu internals), which in this case produces a number (taxonomy term ID) as a result without treating menu links to taxonomy entries in some special way.

I've submitted a patch to Taxonomy Display module but (better safe than sorry) also replaced translation function with much simpler and reliable (no calls to Drupal internal functions that handle menu link translations).

siefca’s picture

Status: Active » Needs review
FileSize
6.81 KB

Hi,

Attaching new revision of the patch. I've added re-sort option taking care of order in which items are displayed. This patch also closes the issue with parent element being marked as active when another (picked) item is also active and gives proper numbers as key prefixes.

When re-sorting is enabled it causes injected entry to be moved at the end of a menu and active entries to be moved to the beginning (when at least one active entry is detected). When no entry is active the injected element becomes active and is inserted as first.

The behavior described above is very helpful when creating drop-down jumpers (with just a few lines of CSS) which are imitating select-lists but without any JS code and without using forms and redirects (cache friendly).