Download & Extend

$page_top prints an empty DIV when logged out

Project:Drupal core
Version:7.x-dev
Component:theme system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Have not investigated why this happens as yet.

system-page-top-empty-div.png

AttachmentSizeStatusTest resultOperations
system-page-top-empty-div.png28.67 KBIgnored: Check issue status.NoneNone

Comments

#1

Status:active» needs review

Edited modules/system/region.tpl.php to only print a region if it has content. system_page_alter checks if a region isn't empty before wrapping it, however that content might eventually not be rendered.

AttachmentSizeStatusTest resultOperations
889882_1.patch601 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 22,942 pass(es).View details

#2

Status:needs review» needs work

Cannot reproduce.
Tested with Toolbar module disabled.
Tested on all core themes.

Any steps to reproduce?

#3

Do a standard install and logout.

Fresh update a few hours ago and fresh install.

AttachmentSizeStatusTest resultOperations
page-top-empty-div-bartik-22nd-August.png44.83 KBIgnored: Check issue status.NoneNone

#4

Patch in #1 fixes the issue but begs the question why this happens only for $page_top and not all other regions.

#5

Status:needs work» reviewed & tested by the community

Looked into this a bit, this happens because toolbar ads some elements to the page top region, but they are not displayed for anonymous users because for them #access = FALSE. So while the render()able array does not look empty, the content once actually rendered is, in fact, empty. This has to be done at the template level because the only safe way to tell if the render()able array is empty is to render it and look at the result, and since we do not want to render the elements twice, we have no choice but to check the result after it is rendered.

#6

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks.

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.