function bodyclasses_get_bodyclasses in Body Classes 7
Retrieve all body classes defined by all modules.
1 call to bodyclasses_get_bodyclasses()
- bodyclasses_preprocess_html in ./
bodyclasses.module - Implements hook_preprocess_html().
File
- ./
bodyclasses.module, line 66 - Body Class module hooks.
Code
function bodyclasses_get_bodyclasses($variables, array $hooks = array()) {
// Retrieve all information for body classes.
$bodyclasses_info = module_invoke_all('bodyclasses_info');
$bodyclasses = array();
// Load the hooks to inject into the body.
if (empty($hooks)) {
$hooks = variable_get('bodyclasses', array());
}
// Find which body classes to add.
foreach ($hooks as $name) {
// If the body class information is available for the given hook.
if (isset($bodyclasses_info[$name])) {
// Execute the hook to retrieve all classes.
$classes = call_user_func($bodyclasses_info[$name]['function'], $variables);
foreach ($classes as $class) {
// Construct the class to inject.
$bodyclasses[] = drupal_html_class($name . '-' . $class);
}
}
}
return $bodyclasses;
}