Inconsistent menu tree parsing

Created on 19 October 2019, about 5 years ago
Updated 22 December 2023, 12 months ago

Problem/Motivation

I noticed on a recent project that Footermap seems to handle parsing the menu tree differently than the system menu blocks, which can create odd inconsistencies. An example, is the following situation. We have a menu structure like this:
- item 1
-- item 1a
- item 2 (disabled)
-- item 2a

The client wants to have the item 2 area to have a navigation when it's linked to, but doesn't want it appearing in the main navigation bar, so they disable the top menu entry of that area. When using the system menu block for the main navigation, I get the expected output of:

- item 1
-- item 1a

However, when using Footermap block, I get an output of:

- item 1
-- item 1a
-- item 2a

This seems to be due to a quirk with how the "onlyEnabledLinks" menu tree parameter function works, in that it returns active links under hidden menu items.

Proposed resolution

  • Adds a configuration option to prevent recurse on disabled menu item/links tentatively named "Hide children of hidden menu links". Defaults to false in config/footermap.settings.yml, and that would avoid needing to write a post-update hook.
  • Checks configuration option when a menu item is not enabled to either recurse children (default) or stop recursing.

Remaining tasks

  1. Add a new test for this feature request

User interface changes

Adds a new form with new translatable strings.

API changes

None

Data model changes

Adds a new nullable key to block.settings.footermap_block mapping.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jacobbell84

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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