Skip to content

Instantly share code, notes, and snippets.

@GoZOo
Created December 12, 2012 15:56
Show Gist options
  • Save GoZOo/4268937 to your computer and use it in GitHub Desktop.
Save GoZOo/4268937 to your computer and use it in GitHub Desktop.
Add class and attributes from custom blocks
/*
* Add class and attributes from custom blocks
*/
function phptemplate_preprocess_block(&$vars) {
if(isset($vars['block']->attributes)) {
if(isset($vars['block']->attributes['class'])) {
$vars['classes_array'] = array_merge($vars['classes_array'], $vars['block']->attributes['class']);
unset($vars['block']->attributes['class']);
}
if(!empty($vars['block']->attributes)) {
$vars['attributes_array'] = array_merge($vars['attributes_array'], $vars['block']->attributes);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment