Created
October 21, 2016 16:39
-
-
Save lkacenja/d239b595e44cc946a043cd54c5d056a0 to your computer and use it in GitHub Desktop.
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
<?php | |
$route_name = \Drupal::routeMatch()->getRouteName(); | |
$bits = explode('.', $route_name); | |
for ($i = 0; $i < count($bits); $i ++) { | |
if ($i == 0) { | |
$body_classes[] = str_replace('_', '-', $bits[$i]); | |
} | |
else { | |
$body_classes[] = str_replace('_', '-', $bits[$i - 1] . '-' . $bits[$i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment