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.
After installing the 6/10 dev version of 7.x I tried to define items in the structure/menus/'secondary menu' page and added code to display it on the web site. But instead of the menu items I defines it displays the items defined under the user menu. Display code is:
if ($secondary_menu && !$in_overlay):
endif;
When I changed the code to select the 'user menu' it gave an undefined index error on 'user menu'
If I need to enable the 'user menu' how do I do it? Even so, why is a request fro secondary menu data returning items stored under user menu?
Comment | File | Size | Author |
---|---|---|---|
#1 | Welcome to MUSEUM | MUSEUM_1276227510686.png | 18.29 KB | dcrocks |
Comments
Comment #1
dcrocks CreditAttribution: dcrocks commentedFurther information. I had positioned the secondary menu outside the block system so I could style it separately and lay it out independent of the block default region definitions. When I added a secondary menu through the structure/blocks page it picked up the correct elements.
I also created a 'main' menu the same way. The results: if a menu is created outside the block system and it is a 'main' menu it picks up the correct items. If it is a 'secondary' menu, it picks up the items defined for the user menu. If it is a 'user' menu it generates error messages. I didn't try the other menu types.
The image shows what I'm trying to do. The 'secondary' menu is on top and the 'main' menu is the bottom one. You can see the standard user menu items displayed by selecting 'secondary' links as in the code above.
Comment #2
dcrocks CreditAttribution: dcrocks commentedps. I am using the 'corolla' theme as a base and it shows the same results when creating menus outside the block system.
Comment #3
dcrocks CreditAttribution: dcrocks commentedApparently content type = 'menus' can only be used inside blocks. There are 2 special menus "main"(=main menu) and secondary(=user menu) that can be used in any region and outside blocks. Use of any other menu outside a block results in 'unknown variable' errors. Why is this? If I want to create a menu for my theme that is displayed outside a block I have to hard code it. Doesn't seem reasonable or friendly. There may be non-core modules out there that solve this but at this stage of 7.X most are still under development. Is this restriction on content type 'menus' documented anywhere(and a reason given)?
Comment #4
JohnAlbinUm… you are inside the contributed module "menu_block"'s issue queue. It is designed to allow you to create configurable blocks of menu trees. And its D7 release is being used on production servers as we speak. Maybe its the module you are seeking in comment #4?
Also, I think you posted in the wrong queue, however, I can answer your question…
The $secondary_menu and $main_menu variables are only valid inside page.tpl and contain the links specified in the admin config form at admin/structure/menu/settings. By default the main menu variable takes its links from the "main menu" and the secondary menu variable takes it links from the "user menu", I believe.
Comment #5
dcrocks CreditAttribution: dcrocks commentedWhat is the difference between 7.x-2.x and 7.x-3.x?
Comment #6
JohnAlbinUse the 7.x-2.0-beta2 release.
Comment #7
dcrocks CreditAttribution: dcrocks commentedI got it, I just need to figure it out, but it looks like what I want. The inconsistent use of secondary menu is confusing, Too bad they couldn't have just used 'user menu' so that the name matched the purpose. Or names distinct from those in structure/menus.
Sorry about picking the wrong issue. I'd like to change it if I could. I guess it should be 'menu system'. I don't think I will be the last person confused by this.
Comment #8
dcrocks CreditAttribution: dcrocks commentedI've found enough info to cope, but I think there will be others asking questions about this.