I'm trying to create a CSS class called .bg-unit-color
which will change depending on the taxonomy reference chosen
I've set up a course category taxonomy and then set up a color field within it using jQuery Colorpicker module. I've got to the point where I can render the color in my node--example.tpl.php file with the following:
<?php
$term=taxonomy_term_load($node->field_example_category['und'][0]['tid']);
$category_color=field_view_field('taxonomy_term',$term,'field_example_category_color');
echo render($category_color);
?>
I've also used the drupal_add_css function in my template.php file, so this works:
$new_color='black';
drupal_add_css(".bg-unit-color {background-color: $new_color;}", 'inline');
However I can't marry the two together to create what I'd like to do which is this:
drupal_add_css(".bg-unit-color {background-color: $category_color;}", 'inline');
Any help would be massively appreciated. Thanks in advance
<?php function mytheme_preprocess_node(&$variables) { }
so that's my next step. Although I haven't quite got there yet