Skip to content

Instantly share code, notes, and snippets.

@jmolivas
Last active September 28, 2015 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmolivas/1373785 to your computer and use it in GitHub Desktop.
Save jmolivas/1373785 to your computer and use it in GitHub Desktop.
Agregar taxonomy term id como clase en el elemento body al visualizar nodo completo
<?php
function NOMBRE_DEL_TEMA_alpha_preprocess_html(&$variables) {
if ( isset($variables) ) {
if(arg(0)=='node' && is_numeric(arg(1))) {
$node = menu_get_object();
if ( isset( $node->field_section['und'][0]['tid'] ) )
$taxonomy_term = $node->field_section['und'][0]['tid'];
if ( isset( $node->field_section['es'][0]['tid'] ) )
$taxonomy_term = $node->field_section['es'][0]['tid'];
if ( isset($taxonomy_term) )
$variables['attributes_array']['class'][] = drupal_html_class('taxonomy-term-' . $taxonomy_term);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment