You are here

function taxonomy_tools_publisher_preprocess_html in Taxonomy Tools 8

Same name and namespace in other branches
  1. 7 taxonomy_tools_publisher/taxonomy_tools_publisher.module \taxonomy_tools_publisher_preprocess_html()

Implements hook_preprocess_html().

File

taxonomy_tools_publisher/taxonomy_tools_publisher.module, line 420
Drupal hooks and functions to manipulate taxonomy terms.

Code

function taxonomy_tools_publisher_preprocess_html(&$variables) {
  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
    $term = taxonomy_term_load(arg(2));
    $vocabularies = array_filter(variable_get('taxonomy_tools_publisher_config', array()));
    if (in_array($term->vocabulary_machine_name, $vocabularies)) {

      // Add a html class to the body depending on term status.
      if (!empty($term->field_taxonomy_term_status) && $term->field_taxonomy_term_status[LANGUAGE_NONE][0]['value'] == TERM_NOT_PUBLISHED) {
        $variables['classes_array'][] = check_plain('term-unpublished');
      }
      else {
        $variables['classes_array'][] = check_plain('term-published');
      }
    }
  }
}