Comments

universalhandle’s picture

Version: 6.x-2.1 » 7.x-2.x-dev
Category: feature » bug
Status: Active » Needs review
StatusFileSize
new5.46 KB

I'm not sure why Katrina B was having a problem using these two modules together in Drupal 6, as I've done so in the past on multiple occasions. However, there is a problem using these two modules together in Drupal 7, and here's a patch to resolve it.

The problem is due to the removal of theme_menu_item_link from D7. In D6, Special Menu Items used this theme function to render certain "links" as span elements. Nice Menus would respect this rewrite in D6 because it was calling theme('menu_item_link', $menu_item['link']). In D7, Special Menu Items moved this functionality to theme_menu_link(). As the D7 version of Nice Menus doesn't call theme('menu_link', $variables) anywhere, it never sees the spans rendered by Special Menu Items.

This patch, rolled against master, changes that and also cleans up some redundant code. I couldn't figure out a "proper" way to pass child items to theme_menu_link such that the children would pass through theme_nice_menus_build instead of the default menu rendering, so I employed a bit of a dirty hack instead. I invite someone more versed in render arrays to improve upon this patch.

While inelegant, it works, and it restores to the D7 version functionality previously available in the D6 version. Please give this patch a test drive and let me know if it needs more work.

Anonymous’s picture

Re-rolled patch to work with drush make against 7.x-2.0.

bschilt’s picture

I'm using Nice Menus with Special Menu Items to make a couple parent menu items render as . But the anchor tag was still being rendered resulting in a page not found error. I installed the patch at #1 and it fixed my issue.

mpotter’s picture

Here is an improved patch that works for me. It makes Nice Menus use standard D7 render arrays and theme calls. Seems to handle child menus correctly.

mpotter’s picture

Here is an updated patch with the dsm() removed!

mpotter’s picture

OK, let's try this one more time!

mpotter’s picture

And one more time to fix bug with $child needing to be $children for menuparent class to work.

mpotter’s picture

Geez, I'm a complete idiot today. Here is the above fix with the dsm removed again. Doh!

vordude’s picture

Status: Needs review » Closed (fixed)
aaronbauman’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

This doesn't work anymore in the latest dev version.
Choosing a "nolink" menu item for the top-most parent results in a menu that starts with the first child, instead of the parent.

Any ideas?

aaronbauman’s picture

Status: Active » Closed (fixed)

nevermind, I think this is actually a different issue.