Create config action which can create an entity for every bundle of another entity type

Created on 29 July 2024, 5 months ago

Problem/Motivation

The addToAllBundles action supported by fields is very, very useful. But it really would be even better if it worked on all content types.

For example, if I want to add the same set of meta tags to every content type...there's no way to do that dynamically without Metatag adding a custom config action for it. Simple Sitemap works the same way. It's a common pattern, but the recipe system has no real support for it.

Proposed resolution

Create a more generic, derived action called createForAllBundles (and a createIfNotExistsForAllBundles) variant.

As with the existing permissions_per_bundle action, this new action's name will vary based on the entity type being targeted. For example, it will have versions called createForEachNodeType and createIfNotExistsForEachTaxonomyVocabulary.

The syntax will look like this:

config:
  actions:
    metatag.metatag_defaults.node__%bundle:
      createForEachNodeType:
        # Some values here

The %bundle token in the config name will be unconditionally replaced by the bundle ID. That will also happen recursively in whatever values are passed to the action. (This is the same token used by the permissions_per_bundle action.)

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
recipe systemΒ  β†’

Last updated 13 days ago

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