Admin Toolbar Search: Remove dependency on Admin Toolbar Tools

Created on 23 July 2025, 9 days ago

Problem/Motivation

Currently, Admin Toolbar Search requires Admin Toolbar Tools, which makes it impossible to only enable admin_toolbar_search if the features of the admin_toolbar_tools are not needed, see:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...

Additionally, looking at the code, there doesn't seem to be any reason this dependency would be absolutely necessary, in the sense, the module already has some logic to skip pieces of code if the admin_toolbar_tools module is disabled.

In other words, the impacts and changes that could be required would be very limited, while still allowing to decouple the modules to provide more flexibility.

Steps to reproduce

Enable the admin_toolbar_search module ==> Requires admin_toolbar_tools to be enabled.

To uninstall the admin_toolbar_tools module, the admin_toolbar_search module needs to be uninstalled first.

Proposed resolution

Replace the dependency on admin_toolbar_tools with admin_toolbar.

The JS and module files should not be impacted, see checks:
admin_toolbar_search.js
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...
Check on drupalSettings.adminToolbarSearch.loadExtraLinks

admin_toolbar_search.module
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...
Check on $admin_toolbar_tools_enabled

Impacted files:
admin_toolbar_search.info.yml: Update dependency constraint.
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...

SearchLinks.php: Ensure the getLinks method exits early if the admin_toolbar_tools module is disabled, just to ensure there is no error if the route /admin/admin-toolbar-search is accessed directly.
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...
This code should not be executed anyway if the module is disabled, since there is a setting in the JS code that skips calling the JSON route if the module is disabled.

AdminToolbarSearchSettingsFormTest
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.1/admin_tool...
Enable the admin_toolbar_tools module in this test, since it is needed to check the display of the three menu local tasks (tabs) defined by the module.

The rest of the code should stay unchanged, in particular all the Automated tests and the module should work very well with only the admin_toolbar module instead and without admin_toolbar_tools.

Remaining tasks

User interface changes

When enabling the admin_toolbar_search module, the admin_toolbar_tools module will no longer be enabled at the same time, but users will have to enable/select it manually as well.

Before:
Select admin_toolbar_search to be enabled ==> Enabled admin_toolbar, admin_toolbar_tools and admin_toolbar_search.

After:
Select admin_toobar_search and admin_toolbar_tools ==> Enabled admin_toolbar, admin_toolbar_tools and admin_toolbar_search.

Select admin_toobar_search ==> Enabled admin_toolbar and admin_toolbar_search.

API changes

Data model changes

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇫🇷France dydave

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

Merge Requests

Comments & Activities

  • Issue created by @dydave
  • Pipeline finished with Success
    9 days ago
    Total: 564s
    #555376
  • 🇫🇷France dydave

    Quick follow-up on this issue:

    All the changes detailed in the issue summary have been implemented and described in the merge request MR !165 above at #2.

    Since all the tests and jobs still seem to be passing 🟢, moving issue to Needs review as an attempt to get more testing feedback and reviews.

    Feel free to let us know if you have any comments, questions or concerns on any aspects of this issue or the suggested changes in the merge request, we would surely be glad to help.
    Thanks in advance!

  • 🇩🇰Denmark ressa Copenhagen

    Great idea to decouple the two sub-modules, and make them independent of each other -- nice job @dydave!

    I can confirm that with the MR, the two sub-modules are now operating as totally individual sub-modules, and you can install and use one without the other.

    Installing them together or separately, all features still work, such as Search without Tools, and vice versa, all features are still present.

    If I try to install just one or the other, only Admin Toolbar is required, as expected:

    $ drush install admin_toolbar_search
    The following module(s) will be installed: admin_toolbar_search, admin_toolbar
    
    $ drush install admin_toolbar_tools
    The following module(s) will be installed: admin_toolbar_tools, admin_toolbar
    
    • dydave committed 204fc2ef on 3.x
      Issue #3537721 by dydave: Admin Toolbar Search: Removed dependency on...
  • 🇫🇷France dydave

    Thanks a lot @ressa, as usual for your promt and very positive feedback! 🙏

    I'm really glad this idea made sense to you too and the changes worked as expected with your tests!

    Honestly, I was a bit surprised to see this had not been done earlier, since it actually required very little code changes with few impacted files. 😅
    So quite easy overall, but with a significant impact.

    Following your confirmation at #4, I went ahead and merged the changes at #5 🥳

    I'm quite happy we could move forward quicker with this task, since it unblocks some of the work I have been doing recently, trying to clean-up and refactor the Admin Toolbar Search module.

    I should be following up shortly with another issue for the Tests and the module file, then another one for the JS code. 👍

    I thought it would be better to break down these refactoring changes into smaller/related changes with specific issues and merge requests, so it would be easier to revert or roll-back in the future.

    Once again, thanks a lot for your great help @ressa reviewing and testing these issues as always.
    Make sure to let me know if you spot anything specific that would need to be addressed quickly, I would surely be very happy to help. 🙂

  • 🇩🇰Denmark ressa Copenhagen

    You're welcome @dydave, I am glad I could assist you in improving Admin Toolbar! And it does seem like a slightly odd and limited dependency. But maybe in the past, they were much closer intertwined, and gradually they drifted apart, until the final break, today?

    Your plan with breaking down the changes into bit-size updates for better management and easier roll-back if needed sounds like a great plan, and it's good to hear that this issue unblocks other areas of your plans for improvement. There's nothing worse than stalling, when you have momentum, and things are flowing. If too long time passes with no progress, you may forget the ideas and plans, and if far too long time passes, there's a risk of a complete halt in the process, and it never gets done.

    So about helping each other out, I thought about a new feature a while ago, but think I didn't create an issue ... but now I finally did: Allow flagging erxtra important issues, to fast track completion Active . Feel free to add more suggestions for features, or other improvements if you see any 🙂

Production build 0.71.5 2024