Closed (fixed)
Project:
Omega
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Reporter:
Created:
16 Jan 2011 at 03:51 UTC
Updated:
15 Feb 2011 at 16:10 UTC
The current 2.x version with the Zone methodology is printing out all the zones, regardless of if there are regions rendered inside it or not...
This is happening because in the default zone.tpl.php
<?php if($enabled): ?>
<?php if($wrapper): ?><div id="<?php print $zid;?>-outer-wrapper" class="clearfix"><?php endif; ?>
<div class="<?php print $classes; ?>" <?php print $attributes;?>>
<?php print render($regions); ?>
</div>
<?php if($wrapper): ?></div><?php endif; ?>
<?php endif; ?>
There is no current check in hook_preprocess_zone or hook_process_zone that sets a flag to see if there IS actually content...
I think the best option here will be to use element_children during the zone process hooks, and if there ARE in fact set another variable such as $populated to include in zone.tpl.php like such:
<?php if($enabled && $populated): ?>
<?php if($wrapper): ?><div id="<?php print $zid;?>-outer-wrapper" class="clearfix"><?php endif; ?>
<div class="<?php print $classes; ?>" <?php print $attributes;?>>
<?php print render($regions); ?>
</div>
<?php if($wrapper): ?></div><?php endif; ?>
<?php endif; ?>
Fairly simple fix, but WILL required editing any customized zone templates in order to implement the fix one I have applied this to the process functionality for zones.
Comments
Comment #1
himerus commentedchanging from bug to task... it's not really a bug as it doesn't affect visual display in modern browsers.
Just cleanup to keep clean markup whenever possible.
Comment #2
himerus commentedThis issue HAS been resolved, and is fine for any new subthemes based on the starterkit.
For any subthemes you already may have created, you will need to edit zone.tpl.php
And replace the relevant section with:
Comment #3
gopherspidey commentedWith "$populated" in my zone file I lost the branding zone (aka logo and menu). That is unless I was doing something wrong.
Comment #4
himerus commentedYes... On several of my test sites and installations, it works properly, but I DID find one case where the user menu zone wasn't being rendered. (in a situation where I've moved the breadcrumb to the top of the page, and that's all that's in the region/zone)
This seems to work in most situations... I may recommend leaving this out for now... and I'll look at this again, and the "special" use cases more in depth.
However, my branding zones stayed present... but I may have had normal blocks placed in supplemental regions inside the branding zone.
Comment #5
himerus commentedOkay, I had to release alpha10 (not my intention) since I consider this quite critical for any users who are starting with alpha9, the changes will apply to all subthemes created, so I needed to tag a new release...
This should be fixed in alpha10, and I will investigate a bit better method of checking for content in those zones.
Since some of the "elements" like the branding area and breadcrumb are non-traditional elements, running element_children() to determine if they are renderable wasn't returning anything, so failing.
I've for now added in code that will just bypass the branding and location zones, which isn't the best solution, but for now fixes the immediate issue.
I may need to get better at being slower to release, and post patches as more and more use this theme moving forward!!!
Thank you for reporting this early though. alpha10 should solve you issue.
Comment #6
gopherspidey commentedThanks for the quick response for this. I am just starting out on a drupal 7 website and based on Omega. I did start with alpha9.
I did not understand why the core developers did most things blocks, but not all. Only leaving out breadcrumbs, logo and slogan.
Comment #7
himerus commentedMarking this as fixed... it is still working, and going to be finalized in the next (alpha11) release.