28 May 2013

This simple snippet shows you how to add body class programmatically from your module in Drupal 7.

Source code viewer
  1. /**
  2.  * Implements hook_preprocess_html().
  3.  */
  4. function HOOK_preprocess_html(&$vars) {
  5. $vars['classes_array'][] = 'your-custom-class';
  6. }
  7.  
Programming Language: PHP