summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Siemssen2011-05-04 07:06:48 (GMT)
committer Sebastian Siemssen2011-05-04 07:06:48 (GMT)
commite995e0cbf0a416bf8d3caa5eb219b7f562909cea (patch)
treecc065c56a085c0ab48ba405e4831939275cf2084
parent02baa1d279d232595f8c8a0997325941e1bb66c2 (diff)
Fixed odd behavior when a zone had a primary region but the sum of the regions widths exceeded the available columns for that zone.
-rw-r--r--alpha/preprocess/preprocess-page.inc54
-rw-r--r--omega/omega.info2
2 files changed, 33 insertions, 23 deletions
diff --git a/alpha/preprocess/preprocess-page.inc b/alpha/preprocess/preprocess-page.inc
index 0c2046d..22465d2 100644
--- a/alpha/preprocess/preprocess-page.inc
+++ b/alpha/preprocess/preprocess-page.inc
@@ -28,6 +28,14 @@ function alpha_alpha_preprocess_page(&$vars) {
$zone_regions[$item['zone']][$region]['#sorted'] = FALSE;
$zone_regions[$item['zone']][$region]['#weight'] = (int) $item['weight'];
+ if (!isset($zones[$item['zone']]['width'])) {
+ $zones[$item['zone']]['width'] = 0;
+ }
+
+ if (!$item['primary']) {
+ $zones[$item['zone']]['width'] += $item['width'];
+ }
+
if (!isset($zone_regions[$item['zone']][$region]['#theme_wrappers']) || !in_array('region', $zone_regions[$item['zone']][$region]['#theme_wrappers'])) {
$zone_regions[$item['zone']][$region]['#theme_wrappers'][] = 'region';
}
@@ -44,32 +52,34 @@ function alpha_alpha_preprocess_page(&$vars) {
foreach ($zones as $zone => $item) {
if ($item['enabled'] && ($item['force'] || isset($zone_regions[$zone]))) {
if (!empty($item['primary']) && isset($zone_regions[$zone][$item['primary']])) {
- $primary = &$zone_regions[$zone][$item['primary']];
-
- $primary['#weight'] = -100;
- $primary['#data']['columns'] = $item['columns'] - $primary['#region']['prefix'] - $primary['#data']['suffix'];
- $primary['#data']['width'] = $item['columns'];
-
- $pull = array();
+ if ($item['width'] < $item['columns']) {
+ $primary = &$zone_regions[$zone][$item['primary']];
+
+ $primary['#weight'] = -100;
+ $primary['#data']['columns'] = $item['columns'] - $primary['#region']['prefix'] - $primary['#data']['suffix'];
+ $primary['#data']['width'] = $item['columns'];
- foreach ($zone_regions[$zone] as $region => $info) {
- if ($region != $item['primary']) {
- $primary['#data']['columns'] -= $info['#data']['width'];
- $primary['#data']['width'] -= $info['#data']['width'];
-
- if ($primary['#data']['weight'] > $info['#data']['weight']) {
- $primary['#data']['push'] += $info['#data']['width'];
- $pull[$region] = &$primary['#data']['width'];
- }
- }
- }
-
- foreach ($pull as $region => $value) {
- $zone_regions[$zone][$region]['#data']['pull'] = $value;
+ $pull = array();
+
+ foreach ($zone_regions[$zone] as $region => $info) {
+ if ($region != $item['primary']) {
+ $primary['#data']['columns'] -= $info['#data']['width'];
+ $primary['#data']['width'] -= $info['#data']['width'];
+
+ if ($primary['#data']['weight'] > $info['#data']['weight']) {
+ $primary['#data']['push'] += $info['#data']['width'];
+ $pull[$region] = &$primary['#data']['width'];
+ }
+ }
+ }
+
+ foreach ($pull as $region => $value) {
+ $zone_regions[$zone][$region]['#data']['pull'] = $value;
+ }
}
}
- $item['type'] = $item['primary'] && isset($zone_regions[$zone][$item['primary']]) ? 'dynamic' : 'static';
+ $item['type'] = $item['primary'] && $item['width'] <= $item['columns'] && isset($zone_regions[$zone][$item['primary']]) ? 'dynamic' : 'static';
if (isset($zone_regions[$zone])) {
$vars['page'][$item['section'] . '_section'][$zone] = $zone_regions[$zone];
diff --git a/omega/omega.info b/omega/omega.info
index b1bb5e3..467494f 100644
--- a/omega/omega.info
+++ b/omega/omega.info
@@ -155,7 +155,7 @@ settings[alpha_hidden_site_name] = ''
settings[alpha_hidden_site_slogan] = ''
settings[alpha_zone_user_wrapper] = '1'
settings[alpha_zone_user_force] = ''
-settings[alpha_zone_user_section] = ''
+settings[alpha_zone_user_section] = 'header'
settings[alpha_zone_user_weight] = '-10'
settings[alpha_zone_user_columns] = '12'
settings[alpha_zone_user_primary] = ''