You are here

function block_class_styles_preprocess_block in Block Class Styles 7.2

Same name and namespace in other branches
  1. 7 block_class_styles.module \block_class_styles_preprocess_block()

Implements hook_preprocess_block().

Parameters

&$vars:

Return value

NULL

Related topics

File

./block_class_styles.module, line 427
Base module file for block_class_styles

Code

function block_class_styles_preprocess_block(&$vars) {
  if (isset($vars['block']->css_class) && ($css = $vars['block']->css_class) && ($style = block_class_styles_get_style($css)) && ($suggestions = _block_class_styles_theme_hook_suggestion($style))) {
    if ($insert_after = array_search('block__block', $vars['theme_hook_suggestions'])) {
      array_splice($vars['theme_hook_suggestions'], $insert_after + 1, 0, $suggestions);
    }
    else {
      $vars['theme_hook_suggestions'] = array_merge($vars['theme_hook_suggestions'], $suggestions);
    }
  }
  if ($vars['block']->title && $vars['block']->title != '<none>' && ($format = variable_get('block_class_styles_title_format', BLOCK_CLASS_STYLES_TITLE_FORMAT))) {
    $vars['block']->subject = check_markup($vars['block']->title, $format);

    // Now strip the outermost <p> which could show up from check_markup
    preg_match('/^\\s*<p>(.*)<\\/p>\\s*$/is', $vars['block']->subject, $found);
    $vars['block']->subject = isset($found[1]) ? $found[1] : $vars['block']->subject;
  }
}