Last active
September 28, 2015 02:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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