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>

Issue fork ds-3004362

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dkosbob created an issue. See original summary.

mrshowerman’s picture

Status: Active » Needs review
StatusFileSize
new776 bytes

This patch adds the classes to the region attributes, without removing the former behaviour, for the sake of BC.

Status: Needs review » Needs work

The last submitted patch, 2: ds-region_attributes-3004362-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mrshowerman’s picture

Status: Needs work » Needs review

Test fail seems unrelated to the patch, back to NR.

swentel’s picture

Version: 8.x-3.x-dev » 5.0.x-dev
swentel’s picture

Version: 5.0.x-dev » 8.x-3.x-dev
swentel’s picture

Status: Needs review » Closed (outdated)
mrshowerman’s picture

Assigned: Unassigned » mrshowerman
Status: Closed (outdated) » Needs work

This has been added in #3294172: Use of ds layouts in layout builder breaks drag&drop blocks

Not 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.

mrshowerman’s picture

Assigned: mrshowerman » Unassigned
Status: Needs work » Needs review
swentel’s picture

StatusFileSize
new640 bytes

Hmm, 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.

mrshowerman’s picture

Issue summary: View changes

I rebased the MR.
@swentel, I added an example to the IS.

swentel’s picture

Status: Needs review » Fixed

alright, thanks, merged!

swentel’s picture

Status: Fixed » Closed (fixed)