Problem/Motivation
It seems like only the path of a module is indexed and used in Admin Toolbar Search.
So for example, a module such as Glossify which "Configure" path is /admin/config/content/formats will not pop up, if you do a search for "gloss".
Steps to reproduce
- Install Glossify and Admin Toolbar Search module
- Search for Glossify with Admin Toolbar Search and get no results
Proposed resolution
I assume it's because only the path is indexed, or searched in, so perhaps we could include the module title as well, when doing a search?

Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
aryan singh commentedWorking on it.
Comment #4
aryan singh commentedComment #5
ressaThanks @aryan singh, it works great! I am now getting suggestions for Glossify with your MR.
And thanks for the review @Gogowitsch, feel free to change issue "Status" to "Needs work" after leaving a GitLab review.
And indeed, sometimes there are false positives for tests, but the failing tests in this case probably need to be looked at ...
@aryan singh: You can find the actual errors by clicking the red failing test icon between "plain diff" and "MR !182 mergeable", and then the "Tests" tab (link https://git.drupalcode.org/issue/admin_toolbar-3549068/-/pipelines/62985...)
... and they do look legit, like for example:
From https://git.drupalcode.org/issue/admin_toolbar-3549068/-/pipelines/62985...
Comment #6
ressaBy the way, DDEV makes it really easy to run test locally:
https://www.drupal.org/docs/develop/automated-testing/phpunit-in-drupal/...
Comment #7
dydave commentedSuper helpful, friendly and nice reply @ressa!
Thanks everyone for getting the work started on this issue 🙂
Overall, I think you've got the right idea here 👍
Great work @aryan-singh, thanks a lot! 🙏
But there is still work needed, indeed....
Good catch @Gogowitsch, PHPSTAN is not happy ☹️
PHPSTAN Errors to fix:
https://git.drupalcode.org/issue/admin_toolbar-3549068/-/jobs/6913650#L51
The tests currently seem to crash here:
https://git.drupalcode.org/issue/admin_toolbar-3549068/-/jobs/6913657#L146
or as indicated by @ressa:
https://git.drupalcode.org/issue/admin_toolbar-3549068/-/pipelines/62985...
Error:
The string "[]" was not found anywhere in the HTML response of the current page.Corresponding to line:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
See the inline comment:
Since you've added the modules to the links array... it is probably not empty anymore....
In other words, from what I understood reading quickly the changes: The links array should never be empty and always contain at least the modules names.... something like that...
So the tests would probably need to be adjusted accordingly to take into account the new logic.
That's what tests are here for ==> Enforcing the logic implemented in module's code and merge requests. 🥳
Other impacts on tests would probably be expected... Since this code adds a substantial new piece of logic to the Admin Toolbar Search module.
==> Needs to be integrated with module's tests.
I have not tested this manually myself... just reviewing the merge request and tests results.
Could there be any way to associate the module name with a URL without having to load the info YAML file and getting the configure link? 😅
Seems pretty heavy ... Any way with JS? Through the HTML code in the admin menu toolbar?
(View source and search for
glossifyand see if anything comes out in the menu links in the admin toolbar, for example)See JS code: https://git.drupalcode.org/project/admin_toolbar/-/blob/3.6.2/admin_tool...
I don't really know yet, since I have not started looking any further at this issue.
Otherwise another option would be to add
ExtraLinksforText Formats, which would fix the issue in this particular case forGlossify, but would not be exactly the same type of feature.Usually, module names can be found in settings forms links, configure links, etc... Added to the admin menu in the toolbar.... So they should get picked up by the Admin Toolbar Search, with JS.
This is not in my list of priorities for now, but I'll try to keep an eye out and help giving advice, reviewing or providing suggestions if anybody fancies working on this. 🙂
Let us know if you have any questions or would need any help on this issue, we would surely try answering as soon as possible.
Thanks in advance! 🙏
Comment #8
aryan singh commentedThank you @ressa for helping me out in finding actual errors.I have solved the phpstan errors that were there in my code.I’ll look further into fixing the PHPUnit test failure. In the meantime, if anyone has suggestions or a solution for the test issue, you’re most welcome to share.
Comment #9
ressaGreat that you got some of the errors fixed, thanks @aryan singh! Though, I need to point out, that it was the module maintainer @dydave, who helped with the actual solutions :)
And thanks as always for the very thorough guidance and pointers @dydave! I very much appreciate you taking the time to do this, as a volunteer, as we all are.
Comment #14
mukhtarm commentedSry for the duplication. But the MR consists of the following:
The issue is that Admin Toolbar Search currently matches against the visible toolbar breadcrumb label and the route path, but not the module name itself. That means searches like Glossify can fail when the actual admin link is something generic like Formatter settings, because neither the label nor the path contains the module name.
The fix adds module names as extra search keywords for installed modules that expose a configure route. On the client side, those keywords are merged onto existing toolbar links by URL, so the visible suggestion label stays the same and duplicate results are avoided. In practice, this means users can now find a module’s config page by searching either the page label/path or the module name.
I also added test coverage for this case with a small fixture module whose admin link title does not contain the module name, and verified the functional BrowserTestBase coverage locally. The existing JS search test was updated to cover this scenario as well.
Comment #16
dydave commentedThanks a lot Muneeb (@mukhtarm) for taking the time to look at this issue and for contributing a merge request, it's greatly appreciated. 🙏
I tried rebasing your changes in MR !210 but I was unable to really understand or clean-up a lot of the unrelated changes there...
I'm not sure exactly, but it looked like the MR was reverting some changes we made more recently in forms and such...
If you don't mind, I allowed myself to hide your MR for now, so maybe you could take another look at it and help cleaning it up a bit so the review could be a bit easier.
Therefore, I thought it would be best to try going back to where I left off the initial merge request MR !183 at #10, which should fix the issue initially reported.
I tested the changes again locally with the Glossify module and it seemed to be work fine.
So mostly: I added another commit to help with the tests coverage, see the updated documentation in the merge request, with the acceptance tests.
Otherwise the rest of the logic is pretty much the same, so at this point, it would be good if would could have another Functional review if possible, of the feature to see if it is working as expected, see a small screenshot of the tests results locally:
Therefore, moving issue to Needs review as an attempt to get more reviews and testing feedback on MR !183.
Requalifying issue as Feature request since this is more a new piece of logic rather than fixing an existing one.
Any questions, comments or reviews would be greatly appreciated.
Thanks in advance!
Comment #17
ressaThanks @dydave for taking another look at my feature request, it works perfectly! And also, I am very grateful for the very thorough test coverage you added: It will surely pay off down the line, if some change elsewhere causes a disturbance in this feature.
Like I wrote, I works well, and I now get "Glossify" suggested in the search bar if I type "glo", so this issue is ready to be committed. Thanks again!
Comment #20
dydave commentedFantastic! Super nice @ressa, as usual, for the super fast and positive feedback! 🤩
I gave this quite a lot of tests locally yesterday, plus I'm quite confident of the PHPUNIT Tests coverage, so your confirmation was enough and since all the jobs and tests were still passing 🟢, I went ahead and directly merged the changes above at #18. 🥳
This is a great new addition to the module (thanks for sharing with us again @ressa) and will hopefully help a lot of users. 👍
Let's keep going through the issue queue and see what we could stacked up in the next 3.6.4 release. 👌
(before switching over to 4.x)
Apart from a bit of documentation, which should be addressed in another existing issue, since I don't see any more actions in this one at this point, marking it as Fixed, for now.
Feel free to let us know if you have any questions or concerns on any aspects of the recent code changes or the project in general, we would surely be glad to help.
Thanks again everyone for the great help on this issue! 😊
Comment #22
ressaThank you so much @aryan singh, @Gogowitsch, @MukhtarM and @dydave for working on this! It's a nice little improvement, making Admin toolbar just a little bit better, and it all adds up 🎉
Thank you @dydave for the final big push to land this feature, and as always for quick and positive responses!