function block_attributes_preprocess_block in Block Attributes 8
Same name and namespace in other branches
- 7 block_attributes.module \block_attributes_preprocess_block()
Implements hook_preprocess().
File
- ./
block_attributes.module, line 97
Code
function block_attributes_preprocess_block(&$variables, $hook) {
if (isset($variables['configuration']['attributes'])) {
$attributes = $variables['configuration']['attributes'];
foreach ($attributes as $name => $value) {
if (isset($variables['attributes'][$name]) && is_array($variables['attributes'][$name])) {
$values = explode(' ', $value);
$values = array_map('trim', $values);
$values = array_filter($values, 'strlen');
$variables['attributes'][$name] = array_merge($variables['attributes'][$name], $values);
}
else {
$variables['attributes'][$name] = [
$value,
];
}
}
}
}