Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295324

Should field_layout treat a region as empty if all fields in that region are empty?

$
0
0

I've got a template like this:

{% if content %}
<div{{ attributes.addClass(classes) }}>
  <div class="layout-region layout-region--main col-sm-8">
    {{ content.main }}
  </div>

  {% if content.sidebar %}
  <div class="layout-region layout-region--sidebar col-sm-4">
    {{ content.sidebar }}
  </div>
  {% endif %}
</div>
{% endif %}

(I have also tried {% if content.sidebar|trim|length > 0 %} with no change.)

A content type using this layout puts a single, optional field into the sidebar region. If that field is empty, I would expect content.sidebar to be empty, so that the sidebar div won't be output and the main div can expand to fill the space. However, instead I get an empty sidebar div.

Is this the expected behavior?


Viewing all articles
Browse latest Browse all 295324

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>