Problem/Motivation

The simplest case for #953034: [meta] Themes improperly check renderable arrays when determining visibility is a region that just consists of [#cache] but no renderable children.

In that case the region MUST be rendered, so even if in a twig template we did:

{% if (element_is_empty(content.sidebar_left)) %}
<div class="sidebar-left">
  {{ content.sidebar_left }}
</div>
{% endif %}

in fact it would _need_ to be:

{% if (element_is_empty(content.sidebar_left)) %}
<div class="sidebar-left">
  {{ content.sidebar_left }}
</div>
{% else %}
  {{ content.sidebar_left }}
{% endif %}

which is very un-intuitive OR element_is_empty would need to actually render the content, which is less than ideal due to performance reasons as we would need to render the sidebar always twice.

Proposed resolution

In BlockPageVariant render empty regions.

Remaining tasks

- Discuss

User interface changes

API changes

Data model changes

Comments

Fabianx created an issue. See original summary.

Fabianx’s picture

Title: Render regions with no children, so empty checks work » 1. Render regions with no children, so empty checks work
Status: Active » Closed (works as designed)

This was already fixed in a different way by ensuring that the cacheability metadata from the build is added to the top-level.

So this simple case is already fixed.