template_preprocess_taxonomy_term

Versions
mediamosa-21
template_preprocess_taxonomy_term(&$variables)

Process variables for taxonomy-term.tpl.php.

Code

modules/taxonomy/taxonomy.module, line 610

<?php
function template_preprocess_taxonomy_term(&$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $variables['term'] = $variables['elements']['#term'];
  $term = $variables['term'];

  $variables['term_url']  = url('taxonomy/term/' . $term->tid);
  $variables['term_name'] = check_plain($term->name);
  $variables['page']      = taxonomy_term_is_page($term);

  // Flatten the term object's member fields.
  $variables = array_merge((array)$term, $variables);

  // Helpful $content variable for templates.
  foreach (element_children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }

  // field_attach_preprocess() overwrites the $[field_name] variables with the
  // values of the field in the language that was selected for display, instead
  // of the raw values in $term->[field_name], which contain all values in all
  // languages.
  field_attach_preprocess('taxonomy_term', $term, $variables['content'], $variables);

  $vocabulary_name_css = str_replace('_', '-', $term->vocabulary_machine_name);

  // Gather classes.
  $variables['classes_array'][] = 'vocabulary-' . $vocabulary_name_css;

  // Clean up name so there are no underscores.
  $variables['theme_hook_suggestions'][] = 'taxonomy-term__' . $vocabulary_name_css;
  $variables['theme_hook_suggestions'][] = 'taxonomy-term__' . $term->tid;
}
?>