$variables['classes_array']
is used in preprocess functions. It adds classes to be used in rendering the element to be processed. In your example, a class named "debug" will be added to the html container of the rendered element: if the actual code is
function <YOUR THEME>_preprocess_html(&$variables) {
if (in_array('administrator',array_values($variables['user']->roles))) {
$variables['classes_array'][]="debug";
}
}
your theme will output a body tag like
<body class='debug [...OTHER CLASSES...]'>
for users with administrator role.
You can also add classes to nodes, or other kind of elements for which a preprocess hook is available. E.g. you could write a node preprocess function:
function <YOUR THEME>_preprocess_node($variables) {
$classes_array[] = 'my-class';
}
if you wanted to add 'my-class' to every node of your site.
In general, you will not find $classes_array
among the defined variables in tpl.php files. Your theme will, most of the times, implode them in a $classes
variable. It must be noted, however, that a kind of confusion arised over time, so different themes may use $classes_array
, $attribute_array
, $classes
, $attributes['class']
and so on for the same purpose, so you should check your theme's documentation to find out what suits your case.