You are here

function block_styles_preprocess_block in Block Styles 8

Same name and namespace in other branches
  1. 2.x block_styles.module \block_styles_preprocess_block()
  2. 1.x block_styles.module \block_styles_preprocess_block()

Implements hook_preprocess_block() for blocks.

File

./block_styles.module, line 20

Code

function block_styles_preprocess_block(&$variables) {
  if (isset($variables['elements']['#id'])) {
    $style = _block_styles_get_style($variables['elements']['#id']);
    if (isset($style['classes'])) {
      $variables['attributes']['class'][] = $style['classes'];
    }
    if (isset($style['text'])) {
      $variables['configuration']['button_text'] = t($style['text']);
    }
    else {
      $variables['configuration']['button_text'] = $variables['configuration']['label'];
    }
  }
}