', array('attributes' => array('rel' => 'home'), 'title' => t('Home'), 'html' => TRUE)) : ''; $vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '', array('attributes' => array('rel' => 'home'), 'title' => t('Home'))) : ''; $vars['main_menu_links'] = theme('links', $vars['main_menu'], array('class' => 'links main-menu')); $vars['secondary_menu_links'] = theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu')); // Make sure framework styles are placed above all others. $vars['css_alt'] = ninesixty_css_reorder($vars['css']); $vars['styles'] = drupal_get_css($vars['css_alt']); } /** * Contextually adds 960 Grid System classes. * * The first parameter passed is the *default class*. All other parameters must * be set in pairs like so: "$variable, 3". The variable can be anything available * within a template file and the integer is the width set for the adjacent box * containing that variable. * * class="" * * If $var_a contains data, the next parameter (integer) will be subtracted from * the default class. See the README.txt file. */ function ns() { $args = func_get_args(); $default = array_shift($args); // Get the type of class, i.e., 'grid', 'pull', 'push', etc. // Also get the default unit for the type to be procesed and returned. list($type, $return_unit) = explode('-', $default); // Process the conditions. $flip_states = array('var' => 'int', 'int' => 'var'); $state = 'var'; foreach ($args as $arg) { if ($state == 'var') { $var_state = !empty($arg); } elseif ($var_state) { $return_unit = $return_unit - $arg; } $state = $flip_states[$state]; } $output = ''; // Anything below a value of 1 is not needed. if ($return_unit > 0) { $output = $type . '-' . $return_unit; } return $output; } /** * This rearranges how the style sheets are included so the framework styles * are included first. * * 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; // 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]); } } } } } return $css; }