ExtraLinks should use route title, instead of hardcoded title

Created on 9 November 2023, over 1 year ago

Problem/Motivation

I've customized route titles, but Admin Toolbar does not show them.

Steps to reproduce

Implement a route subscriber to customize a route provided by \Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks::getDerivativeDefinitions (such as a Field UI route)

Proposed resolution

If we're calling \Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks::routeExists, actually return the route and use its title.

This might be difficult if it uses a title callback, though.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

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

Comments & Activities

  • Issue created by @mglaman
  • Status changed to Closed: won't fix 11 days ago
  • πŸ‡«πŸ‡·France dydave

    Thanks a lot Matt (@mglaman) for creating this issue and taking the time to look in module's current code, it's greatly appreciated! πŸ™

    If the initial requirement is to be able to alter the menu links added by the module, could you please try the approach suggested in the following issue?
    #3488920-2: Change the deriver class of a menu link β†’

    It would seem an implementation of hook_menu_links_discovered_alter could allow modifying any of the menu links added by the admin_toolbar_tools module.

    But the solution suggested in the IS is also interesting though:

    If we're calling \Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks::routeExists, actually return the route and use its title.

    Sure why not, but

    This might be difficult if it uses a title callback, though.

    got me a bit worried... probably some more work here πŸ˜…

    I would greatly appreciate your opinion on this feature and feedback on the solution suggested above, in particular, whether it would really be worth spending more time on fixing this issue in the admin_toolbar_tools module.

    For the time being, closing this issue as Won't fix, since it seems there is already a proper solution provided by Drupal Core.
    Feel free to re-open the issue at any time if you consider these changes would still be needed, we would be glad to take another look.

    Thanks in advance! πŸ™‚

Production build 0.71.5 2024