// Token replacement
$css_tokenized = token_replace($css, $type = 'global', $object = NULL, $leading = '[', $trailing = ']');
// Save the file
file_save_data($css_tokenized, $cache_path);

if you add these lines and remove file_save_data($css, $cache_path);

you have token support,
that way some module can set variables
I would prefer ofcourse a theme but hook_token doesnt seem to work in a theme

Comments

danielbeeke2’s picture

well.. themes do support token hooks

function umbra_fixes_token_values($type, $object = NULL, $options = array()) {
$all = variable_get('theme_umbra_settings','');
if ($type == 'global') {
$tokens['umbra_base_color'] = $all['umbra_base_color'];
return $tokens;
}
}

function umbra_fixes_token_list($type = 'all') {
if ($type == 'user' || $type == 'all') {
$tokens['global']['umbra_base_color'] = t("Umbra base color");
return $tokens;
}
}

I added that to the template.php of my zen subtheme

also I added

$form['umbra_colors']['umbra_base_color'] = array(
'#type' => 'colorpicker_textfield',
'#title' => t('Base color'),
//'#description' => t('This is a textfield associated with a Farbtastic color picker'),
'#default_value' => $settings['umbra_base_color'],
);

to the template-settings.php

in this way you have configureable settings on the theme page.

greetings