Layout options are not applied to empty regions in layout builder

Created on 4 September 2023, about 1 year ago
Updated 22 September 2023, about 1 year ago

Problem/Motivation

Currently, when you add a section in the layout builder that utilizes layout options for its region(s), those options are only applied, if you add a component to the region(s).

This happens because the $regions argument passed into LayoutOptions::build() from core (10.1.2) is empty - see Section::toRenderArray(), where the $regions array is created based on a section's components, which are not available yet for a new section. But this array is used in OptionBase::processAttributeOptionBuild() by checking array_key_exists($region, $regions) which then always returns FALSE.

This may confuse editors when setting up a layout with layout options, where those options do not take effect immediately, but only when the corresponding regions are not empty (e.g. when having selectable classes for a region that define the region's aspect ratio or size).

Steps to reproduce

  • Define layout options (e.g. a class select for the height of a region)
  • Allow the layout options on regions of a layout of your choice
  • Open up a layout builder display and add the layout as new section, while choosing the previously created options for one or more regions
  • Check markup of section in layout builder, no layout option classes are added
  • Add a block to one of the sections with layout option(s) selected - layout options are now applied as expected

Proposed resolution

  • Ensure layout options are also added for empty layout regions

Remaining tasks

  • Create a patch/MR to fix this issue

User interface changes

Layout options will be added to empty layout regions in layout builder as well, even when corresponding region(s) is/are empty

API changes

n/a

Data model changes

n/a

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany hctom

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

Comments & Activities

Production build 0.71.5 2024