The addComponentToLayout config action should support adding multiple components

Created on 7 August 2025, 5 days ago

Problem/Motivation

The addComponentToLayout config action is great, but you can only use it once on any given config entity. There's no pluralized version. If you want to add multiple components to a layout you're just screwed.

This is such a knuckleheaded oversight on my part (shoulda noticed this in review) that I am categorizing it as a bug.

Proposed resolution

Add a pluralized version of the action, addComponentsToLayout, for clarity, and change the action to support $value being a list.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

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

  • Issue created by @phenaproxima
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Merge request !12938Make a pluralized version β†’ (Open) created by phenaproxima
  • Pipeline finished with Failed
    5 days ago
    Total: 116s
    #567488
  • Pipeline finished with Success
    5 days ago
    Total: 984s
    #567494
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    5 days ago
    Total: 146s
    #567508
  • Pipeline finished with Failed
    5 days ago
    Total: 209s
    #567514
  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

    PHPstan doesn't like this:

     ------ ---------------------------------------------------------------------- 
      Line   core/modules/layout_builder/src/Plugin/ConfigAction/AddComponent.php  
     ------ ---------------------------------------------------------------------- 
      96     Undefined variable: $value                                            
             πŸͺͺ variable.undefined                                                 
     ------ ---------------------------------------------------------------------- 
     [ERROR] Found 1 error    
  • Pipeline finished with Success
    5 days ago
    Total: 495s
    #567520
  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

    Thanks for fixing that. Since it is a bug, it doesn't need a change record. I will add an issue to update our documentation when this lands.

    Marking as RTBC.

  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    @phenaproxima pinged me about this as the author of the original action, this looks great to me.

Production build 0.71.5 2024