9

I'm trying to display all 3rd level submenus for a menu item on one page, with each in its own display block. I've tried the Menu Block module but it only seems to work for the active trail, which means I can only display all 2nd Level and 3rd Level menus as one unit rather than just 3rd level menus as separate units.

In addition to the Menu Block module, I also tried access the menu tree directly with this code.

      $main = menu_navigation_links('main-menu', '2');
      echo theme('links__system_main_menu', array(
      'links' => $main,
      'attributes' => array(
      'id' => 'main-menu',
      'class' => array('links')
    ),
  ));
?>

Here's the menu structure:

- Parent Menu 1
- Parent Menu 2
  - Child Menu A
    - SubChild Menu 1A
    - SubChild Menu 2A
    - SubChild Menu 3A    
- Child Menu B
  - SubChild Menu 1B
  - SubChild Menu 2B
  - SubChild Menu 3B

What I'd like to display when Parent Menu 2 is selected:

Block 1: SubChild Menu 1A | Subchild Menu 2A | SubChild Menu 3A

Block 2: SubChild Menu 1B | Subchild Menu 2B | SubChild Menu 3B

Any help on the right way to display submenus separate from their tree would be greatly appreciated.

closed as unclear what you're asking by kiamlaluno Jan 2 '17 at 17:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You need to do some direct db fetch. – niksmac Apr 18 '12 at 4:32
  • You have to set the source for your secondary menu. Although it's for Drupal 6, this video helped me a lot to set it up for Drupal 7: lullabot.com/node/444/play – Tim Apr 18 '12 at 7:51
  • Are "Child Menu A" and "Child Menu B" not actually menu items (i.e. do they just serve as headings or dividers)? Also, why exactly to you want/need to split the two sub-menus into separate blocks? The best/easiest solution may lie outside of what you are trying to do here, so it would help to know what your real end goal is so we can consider other options. – sheena_d Apr 18 '12 at 8:38
  • I ended up doing a direct db fetch: – user1240408 Apr 18 '12 at 14:04
  • Child Menu A and Child Menu B are both menu items. I'm trying to Display all submenus from Child Menu A in one block, all submenus from Child Menu B in another block, etc., all on one page. It's a summary page for all the different Child Menu sections. – user1240408 Apr 18 '12 at 14:10
5

I think the best way to go about it is to just use the Menu block module. Here is a quote about it (from the module's project page):

... have you ever used the Main and Secondary menu links feature on your theme and wondered “how the hell do I display any menu items deeper than that?”

Well, that’s what this module does. It provides configurable blocks of menu trees starting with any level of any menu. And more!

So if you’re only using your theme’s Main menu links feature, you can add and configure a “Main menu (levels 2+)” block. That block would appear once you were on one of the Main menu’s pages and would show the menu tree for the 2nd level (and deeper) of your Main menu and would expand as you traversed down the tree. You can also limit the depth of the menu’s tree (e.g. “Main menu (levels 2-3)”) and/or expand all the child sub-menus (e.g. “Main menu (expanded levels 2+)”).

0

You could use this module: https://www.drupal.org/project/yamb to get your 3rd level submenus with at 2nd level titles.

Not the answer you're looking for? Browse other questions tagged or ask your own question.