function vertical_tabs_generate_stylesheet in Vertical Tabs 6
Color module support for Garland and Vertical Tabs.
Most of this function is direct copy/paste from color_scheme_form_submit().
2 calls to vertical_tabs_generate_stylesheet()
- vertical_tabs_install_color_generate in ./
vertical_tabs.install - Initialize the color-enabled stylesheet if using Garland.
- vertical_tabs_system_theme_settings_submit in ./
vertical_tabs.module - Submit handler for the theme settings page.
File
- ./
vertical_tabs.module, line 153 - Provides vertical tabs capability for fieldsets in forms.
Code
function vertical_tabs_generate_stylesheet($theme, $info, $palette) {
// Current CSS files.
$css = variable_get('color_' . $theme . '_stylesheets', array());
$files = variable_get('color_' . $theme . '_files', array());
// Template file.
$file = 'vertical_tabs.garland.css';
// Prepare target locations for generated files.
$paths['color'] = file_directory_path() . '/color';
$paths['source'] = drupal_get_path('module', 'vertical_tabs') . '/garland/';
$paths['files'] = $paths['map'] = array();
if (count($css)) {
$paths['id'] = preg_replace('/^.*?(' . $theme . '-[a-zA-Z0-9]+).*?$/', '$1', $css[0]);
$paths['target'] = $paths['color'] . '/' . $paths['id'] . '/';
$style = drupal_load_stylesheet($paths['source'] . $file, FALSE);
// Rewrite stylesheet with new colors.
$style = _color_rewrite_stylesheet($theme, $info, $paths, $palette, $style);
$base_file = basename($file);
$css[] = $paths['target'] . $base_file;
$files[] = $paths['target'] . $base_file;
_color_save_stylesheet($paths['target'] . $base_file, $style, $paths);
// Update the list of files.
variable_set('color_' . $theme . '_stylesheets', $css);
variable_set('color_' . $theme . '_files', $files);
}
}