Loading
Issue #3635997: Added the bundle and menu cache tags to the Admin Toolbar Search links.
Fixes https://www.drupal.org/project/admin_toolbar/issues/3635997
Problem
Admin Toolbar Search suggestions from SearchLinks::getLinks() are cached per interface language, but only with list cache tags (config:core.extension, the bundle entity type list tags, config:menu_list). Saving only a translation (a language config override) of a bundle or menu label doesn't invalidate them, so translated suggestions stay stale.
Changes
- Add each bundle's and each menu's
getCacheTags()(e.g.config:node.type.article,config:system.menu.footer) to the cache tags of the search links. Saving a language override invalidates these tags. - New Kernel test
AdminToolbarSearchTranslatedLabelsTest: caches the links in Spanish, edits only the Spanish labels of a content type and a menu, and checks the new labels are returned. It fails without the fix and passes with it.
Testing
- All
admin_toolbar_searchKernel tests pass; phpcs (Drupal, DrupalPractice) is clean. - Manually on Drupal 11.4 with Spanish and
max_bundle_number: 1: before the fix,/es/admin/admin-toolbar-searchkept the old Spanish labels after a translation-only edit; after it, they're updated immediately.
AI disclosure: AI assisted with the investigation, fix and test.
Edited by Sahil Tari