$vars['logo'], 'alt' => t('Home'), 'title' => t('Home'), )); } $vars['linked_logo_img'] = ''; if (!empty($vars['logo_img'])) { $vars['linked_logo_img'] = l($vars['logo_img'], '', array( 'attributes' => array( 'rel' => 'home', 'title' => t('Home'), ), 'html' => TRUE, )); } $vars['linked_site_name'] = ''; if (!empty($vars['site_name'])) { $vars['linked_site_name'] = l($vars['site_name'], '', array( 'attributes' => array( 'rel' => 'home', 'title' => t('Home'), ), )); } // Site navigation links. $vars['main_menu_links'] = ''; if (isset($vars['main_menu'])) { $vars['main_menu_links'] = theme('links__system_main_menu', array( 'links' => $vars['main_menu'], 'attributes' => array( 'id' => 'main-menu', 'class' => array('inline', 'main-menu'), ), 'heading' => array( 'text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'), ), )); } $vars['secondary_menu_links'] = ''; if (isset($vars['secondary_menu'])) { $vars['secondary_menu_links'] = theme('links__system_secondary_menu', array( 'links' => $vars['secondary_menu'], 'attributes' => array( 'id' => 'secondary-menu', 'class' => array('inline', 'secondary-menu'), ), 'heading' => array( 'text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'), ), )); } } /** * 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; } /** * Implements hook_css_alter. * * Alters the css based on the theme settings. */ function ninesixty_css_alter(&$css) { // Get .info defined settings. $settings = array(); foreach (ns_active_themes() as $active_theme) { $settings += ns_theme_info('settings', array(), $active_theme); } // Get floats. $css_float = array(); if (isset($settings['css_float'])) { $css_float = array_flip($settings['css_float']); } // Setup to replace when alternate grid columns are defined. $grid_replace = array(); $ns_target = isset($settings['ns_columns_target']) ? $settings['ns_columns_target'] : NULL; $ns_options = isset($settings['ns_columns_option']) ? $settings['ns_columns_option'] : NULL; $ns_select = isset($settings['ns_columns_select']) ? $settings['ns_columns_select'] : NULL; if (isset($ns_options[$ns_select]) && $ns_target != $ns_options[$ns_select]) { $grid_replace[$ns_target] = $ns_options[$ns_select]; } foreach ($css as $css_path => $css_data) { // Skip if it's not a local file. if ($css_data['type'] != 'file') { continue; } $target_path = $css_path; $target_name = basename($target_path); $target_data = &$css[$target_path]; // Process floats. if (isset($css_float[$target_name])) { // Add it to the system css group instead of creating a new one to // prevent an extra linked group when the styles are aggregated. $target_data['group'] = CSS_SYSTEM; $target_data['weight'] = $target_data['weight'] - .0001; } // Process grid replacement. if (isset($grid_replace[$target_name])) { $grid_alt = str_replace($target_name, $grid_replace[$target_name], $target_path); if (file_exists($grid_alt)) { // Add alternate grid style. $css_new = $target_data; $css_new['weight'] = $css_new['weight'] + .0001; $css_new['data'] = $grid_alt; $_css[$grid_alt] = $css_new; // Remove target unset($css[$target_path]); } } } } /** * Returns the current active theme. Use this instead of the global variable. */ function ns_active_theme() { global $theme_key; return $theme_key; } /** * List the active sub-theme and their connected parents. */ function ns_active_themes() { $themes = list_themes(); $active_theme = ns_active_theme(); $active_themes = array($active_theme => $active_theme); $parent_key = $active_theme; while ($parent_key && isset($themes[$parent_key]->base_theme)) { $parent_key = $themes[$themes[$parent_key]->name]->base_theme; $active_themes[$parent_key] = $parent_key; } return $active_themes; } /** * 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 ns_theme_info($info_key, $default = NULL, $theme_key = NULL) { if (!isset($theme_key)) { $theme_key = ns_active_theme(); } $list_themes = list_themes(); return isset($list_themes[$theme_key]->info[$info_key]) ? $list_themes[$theme_key]->info[$info_key] : $default; }