/** * Implements hook_form_system_theme_settings_alter(). */ function yaffle_bootstrap_form_system_theme_settings_alter(&$form, &$form_state) { $subthemes = array(); foreach (yaffle_bootstrap_subtheme_list() as $name => $info) { $subthemes[$name] = $info['label']; } $form['subtheme'] = array('#title' => t('Subtheme'), '#type' => 'select', '#options' => $subthemes, '#description' => t('Choose the institution subtheme to use.'), '#default_value' => theme_get_setting('subtheme'), '#weight' => -100); }
/** * Implements hook_js_alter(). */ function yaffle_bootstrap_js_alter(&$javascript) { $active_subtheme = theme_get_setting('subtheme'); $subthemes = yaffle_bootstrap_subtheme_list(); // Expose the important colors for use in JavaScript throughout the site. // This is required mainly for the collaborator visualization, which involves // elements that are not styled with CSS. $settings = array('primary_color' => $subthemes[$active_subtheme]['primary_color'], 'secondary_color' => $subthemes[$active_subtheme]['secondary_color']); drupal_add_js(array('theme' => $settings), 'setting'); // Move most of the JS to the footer. $header_scripts = array('drupal.js', 'jquery.min.js', 'settings'); foreach ($javascript as $key => $script) { $paths = explode('/', $key); $filename = array_pop($paths); if ($script['scope'] == 'header' && !in_array($filename, $header_scripts)) { $javascript[$key]['scope'] = 'footer'; } } }