Problem/Motivation
#2756675: Add option to make the starting level follow the active menu item introduced new configuration options, but these options are not defined in menu_block.schema.yml
Proposed resolution
Implement config schema for block.settings.menu_block.*.{follow, follow_parent}
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
The data type for block.settings.menu_block.*.{follow, follow_parent} may change to the data type defined in menu_block.schema.yml
Release notes snippet
Implemented config schema for block.settings.menu_block.*.{follow, follow_parent}
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | menu_block-follow_configuration_schema-3022011-12.patch | 1.58 KB | jeroent |
Comments
Comment #2
idebr commentedAttached patch implements configuration schema data for block.settings.menu_block.*.{follow, follow_parent} as well as an hook_update_N() to fix existing block configuration.
Comment #3
Joshua_Lim commentedi cannot apply this patch??
it says
error: config/schema/menu_block.schema.yml: no such file or directory
why?? i put the patchfile inthe schema folder and also tried to put it in the menu_block folder and apply the patch. it will not work
sorry i'm a beginner
it also says if its in the directory outside
error: menu_block.install: no such file or directory
Comment #4
jeroentTried the patch and worked as expected.
Comment #5
jeroentI created #3038396: Add automated tests to add tests to the menu_block module, to prevent issues like this in the future.
Comment #6
jeroentThis issue is also blocking the tests for menu_multilingual: #3037173: Create tests
Comment #7
joelpittetThank you both @idebr and @JeroenT for moving this patch along.
Do we need to do this against all blocks or is there a way we could do this against just the menu blocks? There may not be but I'd like to check.
Comment #8
jeroentAdded check to only update existing menu_blocks.
Comment #9
idebr commentedWe can take inspiration from an issue in Drupal core that added a key 'expand_all_items' to system_menu_block configuration #2594425: Add the option in system menu block to "Expand all items in this tree"
ConfigEntityUpdaterto make updating easier.The relevant code in the related issue:
Comment #10
jeroentGood suggestion.
Tried making a post_update hook. For some reason $block->get('settings.follow') and $block->set('settings.follow') did not work, so I tried a workaround.
Comment #11
idebr commentedThe post_update hook works great! Two minor points before this is ready:
Code style: the
;should be on the previous line.Comment #12
jeroent1. Fixed. Added a check if the block module is enabled.
2. Fixed.
Comment #13
jeroentFixed a small nitpick.
Comment #14
idebr commentedThe post_update implementation now works correctly when the Block module is not installed. It also updates the block configuration succesfully to the new configuration schema.
The indentation in #12 is correct according to the Drupal Code sniffer.
Comment #15
jeroentComment #16
jeroentComment #17
alison#13 works great for me -- menu_block 8.x-1.5, plus #55 patch on #2756675: Add option to make the starting level follow the active menu item.
Thank you!
Comment #19
joelpittetThank you all, I've pushed this to the dev release
Comment #21
chris matthews commented