Wrong logic when setting layout with complementary part

Created on 26 March 2023, over 1 year ago
Updated 23 February 2024, 9 months ago

It looks like the logic is wrong when setting up layout with complementary in src/Plugin/Preprocess/Page.php:176:

    // Check if sidebars are empty.
    if (empty($variables['page']['sidebar_first']) && empty($variables['page']['sidebar_second'])) {
      $attributes->addClass('layout--with-complementary');
    }

This unnecessarily restricts with of the main content to 66.7 % even when there isn't any block in any of the sidebar regions. I believe it should be set like this, so that layout--with-complementary class is set when one of the sidebars isn't empty:

    // Check if sidebars are empty.
    if (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
      $attributes->addClass('layout--with-complementary');
    }

I will create a MR with this change shortly.

🐛 Bug report
Status

Active

Version

2.4

Component

Code

Created by

🇨🇿Czech Republic milos.kroulik

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024