+
-
+
Index: template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/ninesixty/template.php,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 template.php
--- template.php 18 Jul 2009 17:48:55 -0000 1.1.2.3
+++ template.php 20 Apr 2010 22:47:57 -0000
@@ -14,7 +14,7 @@ function ninesixty_preprocess_page(&$var
$vars['secondary_menu_links'] = theme('links', $vars['secondary_links'], array('class' => 'links secondary-menu'));
// Make sure framework styles are placed above all others.
- $vars['css_alt'] = ninesixty_css_reorder($vars['css']);
+ $vars['css_alt'] = ninesixty_css_alter($vars['css']);
$vars['styles'] = drupal_get_css($vars['css_alt']);
}
@@ -61,49 +61,115 @@ function ns() {
/**
* This rearranges how the style sheets are included so the framework styles
- * are included first.
+ * are included first. It will also swap out optional grid styles based on the
+ * .info data.
*
* Sub-themes can override the framework styles when it contains css files with
* the same name as a framework style. This can be removed once Drupal supports
* weighted styles.
*/
-function ninesixty_css_reorder($css) {
- global $theme_info, $base_theme_info;
+function ninesixty_css_alter($css) {
- // Dig into the framework .info data.
- $framework = !empty($base_theme_info) ? $base_theme_info[0]->info : $theme_info->info;
-
- // Pull framework styles from the themes .info file and place them above all stylesheets.
- if (isset($framework['stylesheets'])) {
- foreach ($framework['stylesheets'] as $media => $styles_from_960) {
- // Setup framework group.
- if (isset($css[$media])) {
- $css[$media] = array_merge(array('framework' => array()), $css[$media]);
- }
- else {
- $css[$media]['framework'] = array();
- }
- foreach ($styles_from_960 as $style_from_960) {
- // Force framework styles to come first.
- if (strpos($style_from_960, 'framework') !== FALSE) {
- $framework_shift = $style_from_960;
- $remove_styles = array($style_from_960);
- // Handle styles that may be overridden from sub-themes.
- foreach ($css[$media]['theme'] as $style_from_var => $preprocess) {
- if ($style_from_960 != $style_from_var && basename($style_from_960) == basename($style_from_var)) {
- $framework_shift = $style_from_var;
- $remove_styles[] = $style_from_var;
- break;
- }
- }
- $css[$media]['framework'][$framework_shift] = TRUE;
- foreach ($remove_styles as $remove_style) {
- unset($css[$media]['theme'][$remove_style]);
+ $grid_base = ninesixty_theme_info('css grid base', '960.css', 'ninesixty');
+ $grid_options = ninesixty_theme_info('css grid options', array(), 'ninesixty');
+ $column_setting = ninesixty_setting('960 columns', '12+16');
+ $debug_setting = ninesixty_setting('960 debug');
+ $debug_style = ninesixty_theme_info('css grid debug', '960-debug.css', 'ninesixty');
+
+ // Pull NineSixty styles to determin all framework styles.
+ // This will be used to force early loading by placing them above all stylesheets.
+ foreach (ninesixty_theme_info('stylesheets', array(), 'ninesixty') as $media => $styles_from_960) {
+ // Setup framework group.
+ if (isset($css[$media])) {
+ $css[$media] = array_merge(array('framework' => array()), $css[$media]);
+ }
+ else {
+ $css[$media]['framework'] = array();
+ }
+ foreach ($styles_from_960 as $style_from_960) {
+ // Force framework styles to come first.
+ if (strpos($style_from_960, 'framework') !== FALSE) {
+ $framework_shift = $style_from_960;
+ $remove_styles = array($style_from_960);
+ // Handle styles that may be overridden from sub-themes.
+ foreach ($css[$media]['theme'] as $style_from_var => $preprocess) {
+ if ($style_from_960 != $style_from_var && basename($style_from_960) == basename($style_from_var)) {
+ $framework_shift = $style_from_var;
+ $remove_styles[] = $style_from_var;
+ break;
}
}
+ // Swap with optional grid styles.
+ if (basename($framework_shift) == $grid_base && isset($grid_options[$column_setting])) {
+ $framework_shift = str_replace($grid_base, $grid_options[$column_setting], $framework_shift);
+ }
+ $css[$media]['framework'][$framework_shift] = TRUE;
+ // Add in debug style.
+ if (basename($framework_shift) == $grid_base && $debug_setting == '1') {
+ $css[$media]['framework'][str_replace($grid_base, $debug_style, $framework_shift)] = TRUE;
+ }
+ foreach ($remove_styles as $remove_style) {
+ unset($css[$media]['theme'][$remove_style]);
+ }
}
}
}
return $css;
}
+
+/**
+ * Pulls theme settings through core's theme_get_setting and falls back to the
+ * 'settings' key found within the active themes .info file. An optional
+ * default can be passed in case no value is found.
+ */
+function ninesixty_setting($setting_key, $default = NULL) {
+ // Core's settings api.
+ $theme_setting = theme_get_setting($setting_key);
+
+ if (!isset($theme_setting)) {
+ // Fallback to the active theme's .info.
+ $info_settings = ninesixty_theme_info('settings', array());
+ if (isset($info_settings[$setting_key])) {
+ // Check for specific setting.
+ // .info setting key = setting[SETTING_KEY] = ...
+ $theme_setting = $info_settings[$setting_key];
+ }
+ }
+
+ return isset($theme_setting) ? $theme_setting : $default;
+}
+
+/**
+ * Get the values defined within the .info file.
+ *
+ * @param $info_key
+ * (required) The key to retrieve.
+ * @param $default
+ * Fall back value if nothing is found.
+ * @param $theme
+ * Theme specific value. If not set, it will return the value for the active
+ * theme.
+ */
+function ninesixty_theme_info($info_key, $default = NULL, $theme = NULL) {
+ global $theme_key, $theme_info, $base_theme_info;
+
+ if (!isset($theme)) {
+ $theme = $theme_key;
+ }
+
+ $theme_info_data = array();
+ if ($theme == $theme_info->name) {
+ $theme_info_data = $theme_info->info;
+ }
+ else {
+ foreach ($base_theme_info as $base_info) {
+ if ($theme == $base_info->name) {
+ $theme_info_data = $base_info->info;
+ break;
+ }
+ }
+ }
+
+ return isset($theme_info_data[$info_key]) ? $theme_info_data[$info_key] : $default;
+}
Index: styles/framework/960-rtl.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/ninesixty/styles/framework/960-rtl.css,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 960-rtl.css
--- styles/framework/960-rtl.css 20 Jun 2009 19:25:54 -0000 1.1.2.1
+++ styles/framework/960-rtl.css 20 Apr 2010 22:47:57 -0000
@@ -29,9 +29,14 @@
/* `Grid >> Children (Alpha ~ First, Omega ~ Last)
----------------------------------------------------------------------------------------------------*/
+/* A more specific selector used in case .alpha and .omega is appled to the same block. */
+.container-12 .alpha,
+.container-16 .alpha {
+ margin-right: 0;
+}
+
.alpha {
margin-left: 10px;
- margin-right: 0;
}
.omega {
@@ -514,4 +519,4 @@
.container-16 .pull-15 {
right: -900px;
-}
+}
\ No newline at end of file
Index: styles/framework/960.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/ninesixty/styles/framework/960.css,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 960.css
--- styles/framework/960.css 20 Jun 2009 19:25:54 -0000 1.1.2.1
+++ styles/framework/960.css 20 Apr 2010 22:47:57 -0000
@@ -40,11 +40,28 @@
.grid-16 {
display: inline;
float: left;
- position: relative;
margin-left: 10px;
margin-right: 10px;
}
+.push-1, .pull-1,
+.push-2, .pull-2,
+.push-3, .pull-3,
+.push-4, .pull-4,
+.push-5, .pull-5,
+.push-6, .pull-6,
+.push-7, .pull-7,
+.push-8, .pull-8,
+.push-9, .pull-9,
+.push-10, .pull-10,
+.push-11, .pull-11,
+.push-12, .pull-12,
+.push-13, .pull-13,
+.push-14, .pull-14,
+.push-15, .pull-15 {
+ position: relative;
+}
+
.container-12 .grid-3,
.container-16 .grid-4 {
width: 220px;
@@ -577,3 +594,37 @@
.container-16 .pull-15 {
left: -900px;
}
+
+/* `Clear Floated Elements
+----------------------------------------------------------------------------------------------------*/
+
+.clear {
+ clear: both;
+}
+
+br.clear {
+ line-height: 0;
+}
+
+/* http://perishablepress.com/press/2009/12/06/new-clearfix-hack */
+/* Drupal core uses .clear-block for the same purpose. */
+
+.clearfix:after {
+ clear: both;
+ content: ' ';
+ display: block;
+ font-size: 0;
+ line-height: 0;
+ visibility: hidden;
+ width: 0;
+ height: 0;
+}
+
+/*
+ The following zoom:1 rule is specifically for IE6 + IE7.
+ Move to separate stylesheet if invalid CSS is a problem.
+*/
+* html .clearfix,
+*:first-child+html .clearfix {
+ zoom: 1;
+}
\ No newline at end of file