Layouts all have a variable called region_attributes that core uses to assign attributes to regions, as per this change record: https://www.drupal.org/node/2886860
It looks like display suite ignores this variable and does it's own thing in ds_preprocess_ds_layout.
Lets make use of region_attributes to keep things consistent with core.
Example for a custom DS based layout with regions region_1 and region_2
Before
<div{{ attributes }}>
<div{{ region1_attributes }}>
{{ region_1 }}
</div>
<div{{ region2_attributes.addClass('foo') }}>
{{ region_2 }}
</div>
</div>
After
<div{{ attributes }}>
<div{{ region_attributes.region_1 }}>
{{ region_1 }}
</div>
<div{{ region_attributes.region_2.addClass('foo') }}>
{{ region_2 }}
</div>
</div>
Comments
Comment #2
mrshowermanThis patch adds the classes to the region attributes, without removing the former behaviour, for the sake of BC.
Comment #4
mrshowermanTest fail seems unrelated to the patch, back to NR.
Comment #5
swentel commentedComment #6
swentel commentedComment #7
swentel commentedThis has been added in #3294172: Use of ds layouts in layout builder breaks drag&drop blocks
Comment #8
mrshowermanNot really: #3294172: Use of ds layouts in layout builder breaks drag&drop blocks brought core's region attributes to DS's; but this issue is for the other way round. We want to use
{{ region_attributes.<region> }}in DS-based layouts.Comment #10
mrshowermanComment #11
swentel commentedHmm, ok , so, updated version which should do the job then I guess? How do I see the difference here, not sure how to reproduce the behavior here.
Comment #12
mrshowermanI rebased the MR.
@swentel, I added an example to the IS.
Comment #14
swentel commentedalright, thanks, merged!
Comment #15
swentel commented