From testing another Bartik issue I noticed that the content looked like it had too big a space above it. Turns out it's an empty messages wrapper printing on the page.


<div id="messages">
  <div class="section clearfix"></div>

Bartik's page.html.twig does have an if statement to print the messages section or not....

{% if messages %}
    <div id="messages">
        <div class="section clearfix">{{ messages }}</div>
{% endif %}

But this obviously does nothing and I can't figure out why....

Proposed resolution

The messages section should only print when there are messages printing.

Remaining tasks

Write a patch
Review the patch

User interface changes


API changes


#1 2426343-1.png486.27 KBdmitrii
#1 2426343-1.patch2.88 KBdmitrii
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,815 pass(es). View
Screen_Shot_2015-02-13_at_17_09_13_1.png468.04 KBemma.maria
Members fund testing for the Drupal project. Drupal Association Learn more


dmitrii’s picture

Status: Active » Needs review
2.88 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,815 pass(es). View
486.27 KB

It's because {{ messages }} is {"#theme":"status_messages","#access":true} so it is always true.
Looks like we should use system template status-messages.html.twig if we want to save

idebr’s picture

{{ if messages }} should be the correct syntax, but currently doesn't work due to #953034: [meta] Themes improperly check renderable arrays when determining visibility. Whatever solution is implemented should reference this issue so it can be updated later on.

idebr’s picture

dmitrii’s picture

Status: Needs review » Needs work

Thank for clarifications.
The issue blocked by #953034 or/and #2289917

Jeff Burnz’s picture

In #2289917: Convert "messages" page element into blocks there is a check has_messages $variables['has_messages'] = !empty($variables['message_list']);, and in any case when that patch lands we will remove messages variable from Bartik and it becomes page.messages + block, likely in #2005546: Use branding block in place of page template branding variables (site name, slogan, site logo) or a new issue, this issue will then close, so I really don't think we should loose sleep on this issue and postpone it.

emma.maria’s picture

Status: Needs work » Postponed

Thanks for the information @idebr and @Jeff Burnz! I tried searching for an issue and couldn't find it myself. Postponing so I don't forget this exists and hopefully the other issues are fixed soon.

joelpittet’s picture

Status: Postponed » Closed (duplicate)

If this problem persists feel free to re-open.