Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292421

Provide a Config Action to add a component in a layout

$
0
0

Problem/Motivation

There is currently no way to add or alter components in a layout via a recipe. We should have a config action that allows recipe to add or edit components in a layout.

Proposed resolution

Created new ConfigSectionListTrait with a config action for adding a new component.

An example provided here:

config:
  actions:
    dashboard.dashboard.test:
      addComponent:
        section: 0
        position: 4
        value:
          uuid: 01929a0b-056f-72c1-b390-c9bdc3f6fd5e
          id: dashboard_text_block
          label: 'My new dashboard with weight'
          label_display: 'visible'
          provider: 'dashboard'
          region:
            layout_twocol_section: 'second'
          default_region: content
          context_mapping: { }
          text:
            value: '<p>My new dashboard with weight</p>'
            format: 'basic_html'

The config action would get a position, and will calculate the weight based on that, and recalculate the weights of the components after this one.
If the uuid already exists, it changes the existing component. If no uuid is provided, a new component is always added with a new recalculated uuid.
The region is a map of layout => region in case we don't know if the given section has a concrete layout.
A default_region can be given in case the section layout is not on that map.

Remaining tasks

Review.

User interface changes

None.

Introduced terminology

None.

API changes

API addition.

Data model changes

None.

Release notes snippet

TBD.


Viewing all articles
Browse latest Browse all 292421

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>