Needs work
Project:
Drupal core
Version:
main
Component:
shortcut.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2026 at 01:52 UTC
Updated:
16 Jun 2026 at 14:30 UTC
Jump to comment: Most recent
$ git grep -li shortcut core/modules/navigation/
core/modules/navigation/config/install/navigation.block_layout.yml
core/modules/navigation/src/Hook/NavigationHooks.php
core/modules/navigation/src/NavigationServiceProvider.php
core/modules/navigation/src/Plugin/Block/NavigationShortcutsBlock.php
core/modules/navigation/src/ShortcutLazyBuilder.php
core/modules/navigation/tests/navigation_test/src/Hook/NavigationTestHooks.php
core/modules/navigation/tests/src/Functional/NavigationSafeBlockDefinitionTest.php
Includes removing Shortcut from ConfigImportAllTest.php because Navigation uses simple config incorrectly. See #13
Review
Review the change record
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
smustgrave commentedGoing to try and help this weekend
Comment #4
smustgrave commentedComment #5
penyaskitoNW per MR review.
Comment #6
smustgrave commentedFeedback should be addressed.
Comment #7
dcam commentedI found a few things and added comments to the MR.
Comment #8
smustgrave commentedI can't resolve threads but can someone do that not sure what's left for this one.
Comment #9
dcam commented@smustgrave, the unresolved action items are:
Comment #10
quietone commentedI've yet to see why ConfigImportAllTest.php is failing on 'search_help'.
https://git.drupalcode.org/project/drupal/-/pipelines/804483/test_report...
Comment #11
quietone commentedFrom the browser output it is failing when re-installing navigation.
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for navigation.block_layout with the following errors: 0 [sections.0.components.00b005e5-d42b-4685-9dc7-272438fbec6b.configuration.provider] Module 'shortcut' is not installed. in Drupal\Core\Config\Development\ConfigSchemaChecker->onConfigSave() (line 98 of core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php).Comment #12
quietone commentedThe Shortcut module now uses hook_navigation_defaults to define default content for the Navigation bar. This used to be defined in the navigation module. So, when the configuration is exported in ConfigImportAllTest the navigation.block_layout contains config that requires the Shortcut module. The test installs everything and exports config. It then uninstalls everything and imports the config. It is the config import that fails with the error shown in the previous comment, that Shortcut is not installed. So, by using hook_navigation_defaults it has navigation now has a dependency on Shortcut. At least that is what I see. How to resolve this?
Comment #13
berdirThere is no clean solution to this. The fact that navigation module store plugin configuration with dependencies in a simple config object is fundamentally wrong and not supported. Simple config can not depend on other modules/config. Similar problems would happen if you place a menu block there and then remove that menu.
Since this is about shortcut being removed, I'd go with a quickfix, that is, exclude shortcut from this test, so we don't run into this situation for this test. AFAIK we do that anyway with deprecated modules, so we're just doing it a bit early in this case.
The only proper fix would be to refactor how navigation module stores it's configuration, for example by putting each block placement into it's own config entity, not unlike block.module handles placed blocks. hook_navigation_defaults() wouldn't even need to exist anymore then, shortcut.module could just provide a default block. And it would also automatically handle dependency removal, removing that block when you uninstall shortcut.
Comment #14
quietone commented@berdir thanks! I made an issue in Navigation, #3587499: Navigation stores plugin configuration with dependencies in a simple config object
Comment #15
dcam commentedThere are a couple of items to take care of that I left comments about in the MR. There is a loss of test coverage that needs to be ported to Shortcut. And the CR URLs in the deprecation notices are still placeholders. Also, we'll need a change record.
Comment #16
quietone commented@dcam, thanks again. Yes, I put zeros in the change record URL and intend to get back to fix it. But too often I forget to do that.
Comment #17
dcam commentedThat's fine. I wasn't 100% sure if that was intentional because you were waiting on some feedback or for some other reason. But I figure it's better to document a finding than not. That way there's less chance that someone else comes along to review, misses the placeholder, and then RTBCs the MR. Thank you for considering my feedback.
Speaking of which, my feedback has been addressed. I think this is ready to send up.
Comment #18
alexpottI'm not sure about one of the comments in the MR. It's pointing to a closed issue - so if it is fixed do we need this code - or is it pointing to the wrong issue?
Comment #19
quietone commentedI had a go at improving the comment.
Comment #20
dcam commentedI think @alexpott's concerns from #18 have been addressed. The comment's point is clearer to me now than it was before.
Comment #21
quietone commentedComment #22
godotislateSome comments on the MR.
Couple more thoughts:
moved_classesservice parameters to move NavigationShortcutsBlock and the navigation ShortcutLazyBuilder. See https://www.drupal.org/node/3509577navigation_shortcut_blockcomponent needs to be removed fromnavigation.block_layoutconfig, because now that block plugin won't exist anymorenavigation_defaultshook is invoked as expected, and the shortcut block is added. OTOH, if Navigation is already installed and Shortcut uninstalled, then if Shortcut is installed thenavigation_defaultshook is not invoked, so the the shortcut block does not get added. I think maybe there needs to be code inshortcut_install()to add it, but there may be problems trying to add tonavigation.block_layoutin the situation where navigation and shortcut are both uninstalled, but are installed in the same request. See MR comment.Comment #23
smustgrave commentedaddressed the first 2 bullets but not sure what to do about the third.
Comment #24
smustgrave commentedtest failure seems relevant to the change in shortcut.install now.
Comment #25
godotislateLooking at the test browser output, looks like there are two instances of the shortcut block now. My mistake,
hook_navigation_defaultsis invoked both onnavigation_install(hook_install) ANDNavigationHooks::modulesInstalled(hook_modules_installed), so the change toshortcut_installis not needed.Still, we should manually test the following scenarios
1. Install minimal profile. Then install navigation and shortcut together
2. Install minimal profile. Then install navigation. Then install shortcut
3. Install minimal profile. Then install shortcut. Then install navigation
And make sure the shortcuts block appears in navigation as expected.
Comment #26
smustgrave commentedSince this is the last blocker for shortcut to get removed, asked Claude for some help and it added a check to see if shortcut was already in the navigation. Lets see if that turns green.
Comment #27
smustgrave commentedAll green what do we think or do we need to add more coverage per 25
Comment #28
godotislateUnless I missed it, I don't see an update test in the MR, so we do need that.
I think confirmation of #25 with manual tests is probably fine.