It seems most likely that the following code is not working due to bad php but I just can't understand why. If I var_dump $variables['classes']
it returns that it is an array with the classes listed in it beautifully.
I debugged the $item
and returns very nicely what I want as well. Then why don't these things get added to my $variables['classes-array'];
?
<?php
function mytheme_preprocess_html(&$variables) {
dsm($variables);
$path = url($_GET['q']);
dsm(var_dump($variables['classes_array']));
$path_items = explode('/', $path);
foreach ($path_items as $item) {
array_push($variables['classes_array'], $item);
}
}
also tried array_push($variables['classes_array'][], $item);
dpm
overdsm
at this point in time. – Lester Peabody Mar 26 at 21:17dsm
you're outputting the$variables
array before you've made changes to it. – Lester Peabody Mar 26 at 21:22