unable to call menu_field_set_active_trail() function without menu tree data

Created on 6 February 2013, almost 12 years ago
Updated 11 November 2024, about 1 month ago

The issue:
Module developers are unable (at least not easily) to manually set an "active" path using code. This sort of functionality is similar to what's provided by menu_position (d7) or menutrails (d6), although each of those modules provides a UI to manage the configuration.

Technical description of the issue:
The menu_field_set_active_trail() function takes a $links array as its first argument. Without that array, the function does not get to the point where the "active" menu item/path is set. The array is built on the fly, and is not [static] cached. Therefore, in order for another module to manually set an active trail, it must also construct the $links array to pass into menu_field_set_active_trail().

A solution:
In order for other modules to be able to set the active trail, a new function should be created that [static] caches the $active_path argument, which is then called by menu_field_set_active_trail(). This allows those modules to initially set an $active_path variable without having to rebuild the entire $links array.

πŸ’¬ Support request
Status

Closed: won't fix

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States gamaroso

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

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