When using theme_nice_menus_primary_links() with Nice Menus 7.x-2.0-beta1 in Drupal 7 RC2 you get the following error:
Notice: Undefined index: content in theme_nice_menus_primary_links() (line 554 of //sites/all/modules/nice_menus/nice_menus.module).
The attached patch (my first patch) fixes this error by changing primary links to main menu and secondary links to secondary menu.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

botris’s picture

You may also want to consider changing the function name from:
theme_nice_menus_primary_links()
to
theme_nice_menus_main_menu()

for consistency.

vordude’s picture

Both good calls.

However, looked at a fresh install from HEAD, and found the variable named, menu_main_links_source (Not menu_main_menu_source as suggested in the patch)

r4f’s picture

I don't know... I still can't make it work... Installed the newest stable D7, tried all the suggestions here (except changing the functions name since it is irrelevent right now).... still it says:

Notice: Undefined index: content in theme_nice_menus_primary_links() (line 556 of /.../sites/all/modules/nice_menus/nice_menus.module).

botris’s picture

@Vordude your right, I found that too in HEAD. But I'm a bit confused, the theme layer uses main_menu according to the documentation:
http://drupal.org/update/theme/6/7#menus

So should it be?
$menu_name = variable_get('menu_main_links_source', 'main-menu');

@R4f , can't tell patch works for me.
Do you use the following in your page.tpl.php:
print theme('nice_menus_primary_links');
You need to use the "old" function name.

justafish’s picture

The patch in the original post worked for me after replacing the call to the menu in my page.tpl.php with

<?php print theme('nice_menus_primary_links'); ?>
chules’s picture

Where exactly in the page.tpl.php is the call to the menu? I am looking to replace it with print theme('nice_menus_primary_links'); but not sure which line(s) to replace.

thank you chules

alpritt’s picture

FileSize
4.59 KB

So should it be?
$menu_name = variable_get('menu_main_links_source', 'main-menu');

Yes.

This patch changes the function names and other references to primary and secondary links and fixes the above.

alpritt’s picture

FileSize
4.59 KB

Last patch missed a reference to 'primary links' in the README.

amateescu’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev
FileSize
7.21 KB

Another re-roll for current HEAD which fixes the following:

- theme_nice_menus_main_menu() and theme_nice_menus_secondary_menu() should not receive a $menu variable because they already know what menu they're supposed to theme.
- removes deprecated D6 theme functions.
- fixes some Doxygen blocks that didn't have an empty line before the $return statement.

With this patch, printing the main menu is as simple as:

<?php
  print theme('nice_menus_main_menu');
?>
cesar.brod@gmail.com’s picture

This worked fine for me. I haven't been able to figure out how to style the original rounded corners main menu you can see in Bartik though. Any hints?

JoelAddison’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch in #9 against 7.x-2.0-beta3, and everything is working as expected. It would be great if this could be committed, as I am sure I am not the only one needing to patch this everytime a new version is released.

vordude’s picture

Status: Reviewed & tested by the community » Fixed

committed with fe14c0e900ae586ef15 thanks for hammering this out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.