Problem/Motivation
There are cases where a recipe needs to do config actions on an entity...if, and only if, it exists. If the entity doesn't exist, the config actions should obviously be bypassed.
Recipes should have an explicit syntax for this, enabling smooth and optional integrations.
Proposed resolution
Syntax like this:
config:
actions:
?canvas.component.block.simple_search_form_block:
# SOME ACTIONS HYAR
Remaining tasks
Implement this with test coverage.
User interface changes
None.
Introduced terminology
None.
API changes
Recipes will receive new syntax.
Data model changes
None.
Release notes snippet
TBD, but it'll need a change record.
Comments
Comment #2
phenaproximaComment #5
bircherComment #6
phenaproximaCouple of minor points but damn this looks good. We should get it committed post-haste.
Comment #7
phenaproximaCR drafted: https://www.drupal.org/node/3552215
Comment #8
phenaproximaOne request, otherwise RTBC.
Comment #9
bircherComment #10
phenaproximaStraightforward and tested.
Comment #11
alexpottFor MR comment.
Comment #12
thejimbirch commentedIt is super subtle for this to only have a question mark on the end. Are there any other patterns/options that would make this more obvious to recipe authors?
If not, I will recommend always including a comment when this is used in the documentation.
It would be good to also document some use cases for the change record.
Comment #13
phenaproximaDiscussed with @alexpott and we agreed to move the question mark to the beginning of the config name, not the end. That matches PHP nullable parameters and Symfony's optional container services.
Comment #14
thejimbirch commentedThat makes it much more obvious. Moving to RTBC, thanks!
Comment #15
alexpottCommitted fe059b3 and pushed to 11.x. Thanks!
Comment #19
penyaskitoFixed IS syntax in case someone looks at this issue instead of the change record.