function block_class_preprocess_panels_pane in Block Class 7
Same name and namespace in other branches
- 7.2 block_class.module \block_class_preprocess_panels_pane()
Implements hook_preprocess_HOOK().
Extend panel block's classes with any user defined classes.
File
- ./
block_class.module, line 41 - Enhanced control over the CSS Classes of any Block.
Code
function block_class_preprocess_panels_pane(&$vars) {
if ($vars['pane']->type != 'block') {
return;
}
// Infer the block's $module and $delta from the pane subtype.
$block_parts = explode('-', $vars['pane']->subtype);
// Load the block based on the block parts.
$block = block_load($block_parts[0], $block_parts[1]);
// Return block_class classes as string.
$css_class = block_class($block);
// Add a generic 'module type' pane class.
$vars['classes_array'][] = drupal_html_class('pane-' . $block->module);
// Add $css_class to the $classes_array.
$vars['classes_array'][] = $css_class;
}