Show items on same level if active menu level doesn't have children

Created on 31 March 2010, over 14 years ago
Updated 28 August 2024, 3 months ago

Problem/Motivation

Version 6.x-2.2 of Menu Block module had a key feature that would fallback to showing items on the current level (i.e. siblings to the active menu item) when the active menu item doesn't have any children.

Neither Drupal 7 nor Drupal 8/9 versions of the Menu Block module have this feature.

This is a very common use case for creating a sidebar secondary nav that is only ever supposed to be one or two levels deep at any given time, but is setup to always show as much relevant information as possible.

Steps to reproduce

If a menu block is configured to:

  • show 1 level,
  • follow the active menu item,
  • set the initial visibility rule to show Children of active menu item.

then when the user clicks on any child link, the menu display is less than helpful and only contains a single item (the current page).

Proposed resolution

Add a third option to the "Initial visibility level" radios:

  • Active menu item
  • Children of active menu item
  • New option: Children of active menu item; active menu item if no children

Remaining tasks

User interface changes

Users will see a new option in the menu block configuration screen.

API changes

The follow_parent menu block setting variable will respond to a new option called child_or_active in code.

Data model changes

N/a

Feature request
Status

RTBC

Version

1.0

Component

Miscellaneous

Created by

🇷🇺Russia temp

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024