[meta] Make config actions more dynamic

Created on 30 January 2024, 11 months ago
Updated 1 June 2024, 7 months ago

Problem/Motivation

I think it would be useful for a recipe to say, for example, "make this change to all content types". Currently, I'm not aware of any way to do that.

Proposed resolution

In the config:actions section of recipe.yml, I'd suggest we support syntax like in #7:

config:
  actions:
    core.entity_view_display.node.*.*:
      - setComponent:
          field: field_foo
          settings: {}
    core.entity_form_display.node.*.*:
      - setComponent:
          field: field_foo
          settings: {}

In this example, if you know you have instantiated field_foo on every content type (without necessarily knowing the exact names of those content types), you might want to be sure it is visible on the form and view displays of every content type.

We identified several potential use cases for a feature like this (the actual syntax we come up with might vary):

Obviously, some of these need to be implemented differently than others. So these cases should be thought through further, and split out into their own issues.

In general, though, I see two patterns in these use cases:

  1. The ability to expand the meaning of *. This could be accomplished in a pretty straightforward manner, I think; \Drupal\Core\Recipe\RecipeRunner::processConfiguration() could convert * into a regex, and apply it against all existing configuration names to find the one(s) that the action should apply to. This would add up to a few extra lines in that method. Let's do that in #3420209: Allow config actions to be applied to multiple config entities using wildcards β†’ .
  2. New config actions that belong only to particular config entity types, allowing them to take advantage of the specific nature and superpowers of those entity types. Examples:

    Because of their specificity, I think each of these cases (or any others we think of) would need to be done in their own issues.

✨ Feature request
Status

Fixed

Version

11.0

Component

Code

Created by

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

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

Comments & Activities

Production build 0.71.5 2024