Fairly typical menu structure such as

Home
About Us
Overview
Management
Contact
Products
Services

The default settings display all of those items in one column. I can set recursive to "1" and then only the 4 parent items are displayed. Overview, Management, and Contact are not.

Is there a way that I can display those child items on pages they are associated with?

For example, every page would have the Main Menu in the first column with Home, About Us, Products, and Services. But if someone were on the About Us page, or any of the About Us child pages, they would be able to see a second footermap menu column that displays just those child items.

thanks

Comments

mradcliffe’s picture

Component: Miscellaneous » Documentation
Status: Active » Needs work

Not without a lot of template_preprocess or template hackery.

I think you could do this by not having a recurse limit, and then in the template checking where things are with the #level property.

You should theoretically be able to loop through $footermap['main-menu'][$child]['#items'] and check the #level to see if it's less than 2 (or 1?), and then add that to a new #items array that you will set later. Take anything higher than that, that matches the base path of menu_get_active_menu_names() and stick it into a new child array's #items.

So I think you'd end up with a render array like this:

array(
  'main-menu' => array(
    // Contains other elements as well.
    '#theme' => 'footermap_header',
    '#items' => array(
      // items
    ),
  ),
  'new-menu' => array(
    // Contains other elements as well.
    '#theme' => 'footermap_header',
    '#items' => array(
      // only items that should be in the active path or trail.
    ),
  ), // This array is added on the fly
);

I'll probably need to document more about the theme function.

mradcliffe’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.