Allow recipe input values in array keys

Created on 2 January 2025, 9 months ago

Problem/Motivation

Recipe input values cannot be used in array keys. For example, something like this won't work:

config:
  actions:
    node.type.${content_type}:
      setLabel: 'Whatever'

In the name of not accidentally creating more API surface, this limitation was deliberate when recipes introduced support for input. I also feared that this would reduce the predictability of recipes by making them behave more like functions. I still think that keeping things tightly scoped and low-key was, at the time, the right call.

But, having had some time to actually implement inputs in certain recipes (for Drupal CMS in particular), I think this is probably more useful than scary. Although it does make the recipe less "predictable" at a glance, it's not that much less predictable -- you can still tell what the recipe will do, it's just a question of what config items it will do it to. They would still not have the ability to make decisions or do branching logic. Recipes would gain the ability to act like content type factories/templates, which is a legitimate use for them.

Proposed resolution

Allow inputs to be replaced in array keys, as well as array values, of config actions.

✨ Feature request
Status

Active

Version

11.1 πŸ”₯

Component

recipe system

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024