Regions are rendered due to empty region_classes

Created on 24 January 2024, 5 months ago
Updated 29 January 2024, 5 months ago

Problem/Motivation

Steps to reproduce

When a region has a region_class set to empty, it nevertheless gets an empty Attributes object.

For example, this is a default content node export:

          regions_classes:
            sidebar: ''
            highlighted: form-highlighted
            highlighted_bottom: ''
            main: ''
            content: ''

The saved value for highlighted_bottom is '' and the region has no blocks placed, but the current code will still create the content.region with an Attributes object only with an empty '' class.

This means any check on twig will fail and output the region, even if empty. Example:

    {% if content.highlighted_bottom %}
           <h1>I will render no matter the emptyness of the region</h1>
          {{ content.highlighted_bottom }}
      </div>

Proposed resolution

Perform an additional check to discern if the region_class is actually populated.

πŸ› Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024