Created
July 14, 2015 15:37
-
-
Save ericjgruber/a4a1482e90428caa5539 to your computer and use it in GitHub Desktop.
Add a class to every page in Drupal 7
This file contains hidden or 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
/** | |
* Implements hook_preprocess_htm(). | |
*/ | |
function THEME_preprocess_html(&$variables) { | |
$path = drupal_get_path_alias(); | |
$aliases = explode('/', $path); | |
foreach($aliases as $alias) { | |
$variables['classes_array'][] = 'page-alias-' . drupal_clean_css_identifier($alias); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment