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

Umami Theme - follow-up - checking for empty regions before printing the region

$
0
0

Reported in: https://www.drupal.org/project/drupal/issues/2809635#comment-12432197

From issue:
==============
+++ b/core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig
@@ -0,0 +1,132 @@
+ {% if page.header|render|striptags|trim is not empty %}
...
+ {% if page.tabs|render|striptags|trim is not empty %}
...
+ {% if page.banner_top|render|striptags|trim is not empty %}
...
+ {% if page.breadcrumbs|render|striptags|trim is not empty %}
...
+ {% if page.page_title|render|striptags|trim is not empty %}
...
+ {% if page.sidebar|render|striptags|trim is not empty %}
...
+ {% if page.footer|render|striptags|trim is not empty %}
...
+ {% if page.bottom|render|striptags|trim is not empty %}

Is this the only way we can do this? Surely we can do something smarter in preprocessing?
==============

If we just print

{% if page.tabs %}
{{ pagetabs }}
{% endif %}

We get empty regions printed on every page that there is no block in that region for. So on a views page, we'll have<div class="region-tabs"></div>

This is a known issue in Drupal core, so we can't fix it until that is fixed.
https://www.drupal.org/node/953034


Viewing all articles
Browse latest Browse all 295267

Trending Articles



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