You are here

function hook_preprocess_block in Block Class Styles 7.2

Implements hook_preprocess_block().

An example to show how you can add a style group suggestion tpl based on some logic, in this case the machine name of the style.

The end result is that all styles that begin with panel_ will be given one additional tpl suggestion

block--panel.tpl.php

Related topics

1 function implements hook_preprocess_block()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

block_class_styles_preprocess_block in ./block_class_styles.module
Implements hook_preprocess_block().

File

./block_class_styles.api.php, line 28
Defines the api functions of the module

Code

function hook_preprocess_block(&$vars) {
  $style = isset($vars['block']->block_class_styles) ? $vars['block']->block_class_styles : NULL;

  // Detects if our style suggests this is a panel block.
  if ($style && preg_match('/^panel_/', $style->name)) {
    $vars['theme_hook_suggestions'][] = 'block__panel';
  }
}