Problem/Motivation
Navigation needs to provide a simple way to add new blocks programmatically.
This issue aims to provide these config actions that would allow to integrate Navigation with recipes.
Steps to reproduce
N/A
Proposed resolution
Provide Config Action to add new blocks to navigation from recipes
Remaining tasks
Review
User interface changes
N/A
Introduced terminology
N/A
API changes
New config action
Data model changes
N/A
Release notes snippet
TBD
Issue fork drupal-3478224
Show commands
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:
- 3478224-provide-config-action
changes, plain diff MR !9724
- 3478224-proof-of-concept
compare
Comments
Comment #3
plopescFirst shot for this one.
It allows to provide a recipe like this:
After applying the recipe, a new block with the settings described above is added to the Navigation.
This one needs tests and some extra work, but let's open the discussion about it.
Comment #4
penyaskitoI hoped we could do this generically or at least provide a trait in layout builder so we don't repeat ourselves. See #3475115: Provide a Config Action to add a component in a layout. I have some WIP for that one that I will upload before next week.
Comment #5
plopescThank you for bringing up that issue, I was unaware of it. Definitely avoid reinventing the wheel should be a priority.
Navigation use case might differ a bit, given that sections and regions are more limited than in other scenarios. I'm pretty sure we could take advantage of that trait, though.
This initial approach is a proof of concept to validate the approach. More than happy to readjust it to be based on the code in the mentioned issue once it is ready.
Thanks!
Comment #6
plopescComment #7
plopescThis will be probably necessary for Starshot.
Comment #8
plopescInitial approach including base test coverage.
Comment #10
smustgrave commentedAppears to have some open threads
Also tagging for a change record.
Comment #11
m4oliveiMR looks pretty good. The other core issue, #3475115: Provide a Config Action to add a component in a layout is moving along since last mentioned here. When I looked over it, it seems like it would cover our use case. It's also been marked as a Starshot blocker, so the timeline should fit our needs here.
@plopsec, what do you think? If it covers everything we need, this issue would no longer be relevant correct?
Comment #12
plopesc@m4olivei The way LB is implemented in Navigation, nested in a different config entity makes impossible to use the trait approach described in #3475115: Provide a Config Action to add a component in a layout.
We discovered it when I tried to apply it to this one. See comments #6 & #7 in #3475115: Provide a Config Action to add a component in a layout.
If we want to provide config actions for Navigation, with the tools we have today, it should be based on a custom plugin.
Comment #13
m4oliveiAhh, now I understand. Thanks for explaining that. Our LB configuration is in simple config, whereas the config action in #3475115: Provide a Config Action to add a component in a layout needs to work on config entities.
I'll work on the remaining feedback here.
Comment #14
m4oliveiAll threads are addressed. Looking good to me. Setting to Needs review.
Comment #15
pameeela commentedComment #16
phenaproximaThis seems straightforward enough to me. I have a few minor points but otherwise I'd say RTBC.
Comment #17
plopescThank you for your review. Feedback addressed.
Comment #18
plopescDraft CR created.
Comment #19
penyaskitoI've reviewed the code, checked all the feedback and verified it was resolved.
This unblocks some usecases for the dashboard contrib module too.
So RTBC.
Comment #23
catchCommitted/pushed to 11.x and cherry-picked to 11.1.x, thanks!
Comment #26
thejimbirch commentedComment #27
thejimbirch commented