I have condition for printing regions in my page template as is not empty, but it will always print empty regions no matter what. What is the proper way to detect empty regions?
For example, {% if page.local_tasks is not empty %}{{ page.local_tasks }}{% endif %}
prints out <div class="region region-local-tasks"></div>
.
If I render the region in themename_preprocess_page()
with var_dump(drupal_render($variables['page']['highlighted']));
I will get SafeString with placeholder token:
<div class="region region-highlighted"><drupal-render-placeholder callback="Drupal\Core\Render\Element\StatusMessages::renderMessages" arguments="0" token="a8c34b5e"></drupal-render-placeholder></div>
So, technically the region is not empty but I can do nothing about it.
page.local_tasks
contain when you feel it should be empty?