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.

Issue fork drupal-3552023

Command icon 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:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Issue tags: +Needs change record

bircher made their first commit to this issue’s fork.

bircher’s picture

Status: Active » Needs review
phenaproxima’s picture

Issue tags: +Vienna2025

Couple of minor points but damn this looks good. We should get it committed post-haste.

phenaproxima’s picture

phenaproxima’s picture

Status: Needs review » Needs work

One request, otherwise RTBC.

bircher’s picture

Status: Needs work » Needs review
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Straightforward and tested.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

For MR comment.

thejimbirch’s picture

It 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.

phenaproxima’s picture

Discussed 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.

thejimbirch’s picture

Status: Needs work » Reviewed & tested by the community

That makes it much more obvious. Moving to RTBC, thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed fe059b3 and pushed to 11.x. Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • alexpott committed fe059b39 on 11.x
    Issue #3552023 by phenaproxima, bircher, alexpott, thejimbirch: Recipes...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

penyaskito’s picture

Issue summary: View changes

Fixed IS syntax in case someone looks at this issue instead of the change record.