Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I added this code to my themes template.php which adds a class 'homebox' to the body class attribute. There might be a better way to do it.
/**
* Override or insert variables into the html template.
*/
function MYTHEME_preprocess_html(&$vars) {
$current_page = menu_get_item();
if (isset($current_page['page_callback']) && $current_page['page_callback'] == 'homebox_build') {
$vars['classes_array'][] = 'homebox';
}
}
Comments
Comment #1
HansKuiters CreditAttribution: HansKuiters commentedSure would be nice.
Comment #2
HansKuiters CreditAttribution: HansKuiters commentedOk, that wasn't too hard.
I added this code to my themes template.php which adds a class 'homebox' to the body class attribute. There might be a better way to do it.
Comment #3
drummThat is indeed the best way to do it.