Make menu tail load work without specifying the loader arguments

Created on 21 March 2012, over 12 years ago
Updated 26 June 2023, about 1 year ago

Problem/Motivation

The %menu_tail wildcard loader for the menu system currently requires you to manually ensure the 'loader arguments' are supplied by specifying them in your menu item definition. This is well documented in the API docs for menu_tail_load:

To use this load function, you must specify the load arguments in the router item as:

$item['load arguments'] = array('%map', '%index');

But this means these extra arguments are supplied to all menu loaders for that menu item, possibly causing problems. We should be able to special case menu_tail_load so that module authors do not need to specify them.

This was discussed when menu_tail_load was introduced: http://drupal.org/node/298561#comment-3489624 But the choice was made to document the need to add the extra code, and place the burden on module developers.

Proposed resolution

We can special case menu_tail_load when being processed by the menu system so that module developers don't need to specify the loader arguments manually.
By doing this we can also clean up some of places where we can't use menu_tail_load right now, such as autocompletion callbacks.

Remaining tasks

  • Write some tests.
  • Review the tests.
  • Review the patch.
  • Write documentation for '#autocomplete_path' suggesting the use of '%menu_tail'

User interface changes

N/a

API changes

This would remove the need to specify the 'loader arguments' when using menu_tail_load.

✨ Feature request
Status

Closed: outdated

Version

9.5

Component
Menu systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¬πŸ‡§United Kingdom Steven Jones

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

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