Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#9 | 1002054-D7_menu_name_changes.patch | 7.21 KB | amateescu |
#8 | 1002054.patch | 4.59 KB | alpritt |
#7 | 1002054.patch | 4.59 KB | alpritt |
menu_names.patch | 1.1 KB | botris | |
Comments
Comment #1
botrisYou may also want to consider changing the function name from:
theme_nice_menus_primary_links()
to
theme_nice_menus_main_menu()
for consistency.
Comment #2
vordude CreditAttribution: vordude commentedBoth 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)
Comment #3
r4f CreditAttribution: r4f commentedI 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).
Comment #4
botris@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.
Comment #5
justafishThe patch in the original post worked for me after replacing the call to the menu in my page.tpl.php with
Comment #6
chules CreditAttribution: chules commentedWhere 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
Comment #7
alpritt CreditAttribution: alpritt commentedYes.
This patch changes the function names and other references to primary and secondary links and fixes the above.
Comment #8
alpritt CreditAttribution: alpritt commentedLast patch missed a reference to 'primary links' in the README.
Comment #9
amateescu CreditAttribution: amateescu commentedAnother re-roll for current HEAD which fixes the following:
-
theme_nice_menus_main_menu()
andtheme_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:
Comment #10
cesar.brod@gmail.com CreditAttribution: cesar.brod@gmail.com commentedThis 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?
Comment #11
JoelAddison CreditAttribution: JoelAddison commentedTested 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.
Comment #12
vordude CreditAttribution: vordude commentedcommitted with fe14c0e900ae586ef15 thanks for hammering this out.