function _color_html_alter
Replaces style sheets with color-altered style sheets.
A theme that supports the color module should call this function from its THEME_process_html() function, so that the correct style sheets are included when html.tpl.php is rendered.
See also
theme()
2 calls to _color_html_alter()
- bartik_process_html in themes/
bartik/ template.php - Override or insert variables into the page template for HTML output.
- garland_process_html in themes/
garland/ template.php - Override or insert variables into the html template.
File
-
modules/
color/ color.module, line 85
Code
function _color_html_alter(&$vars) {
global $theme_key;
$themes = list_themes();
// Override stylesheets.
$color_paths = variable_get('color_' . $theme_key . '_stylesheets', array());
if (!empty($color_paths)) {
foreach ($themes[$theme_key]->stylesheets['all'] as $base_filename => $old_path) {
// Loop over the path array with recolored CSS files to find matching
// paths which could replace the non-recolored paths.
foreach ($color_paths as $color_path) {
// Color module currently requires unique file names to be used,
// which allows us to compare different file paths.
if (drupal_basename($old_path) == drupal_basename($color_path)) {
// Replace the path to the new css file.
// This keeps the order of the stylesheets intact.
$vars['css'][$old_path]['data'] = $color_path;
}
}
}
$vars['styles'] = drupal_get_css($vars['css']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.