You are here

function blocktheme_preprocess_block in Block Theme 6

Same name and namespace in other branches
  1. 8 blocktheme.module \blocktheme_preprocess_block()
  2. 7 blocktheme.module \blocktheme_preprocess_block()

Implementation of hook_preprocess_block().

File

./blocktheme.module, line 302
Provides a configuration option to select custom themes for blocks

Code

function blocktheme_preprocess_block(&$vars) {
  if ($custom_block_theme = blocktheme_get_theme($vars['block'])) {

    // Added for downward compatibility:
    // Remove blocktheme- prefix if present
    // Maybe use an update instead?
    $len = drupal_strlen('blocktheme-');
    if (strncmp($custom_block_theme, 'blocktheme-', $len) == 0) {
      $custom_block_theme = drupal_substr($custom_block_theme, $len);
    }
    $vars['blocktheme'] = $custom_block_theme;
    $vars['template_files'][] = 'blocktheme-' . $custom_block_theme;

    // Added for backward compatibility
    $vars['template_files'][] = $custom_block_theme;
  }
  if ($custom_block_vars = blocktheme_get_theme_vars($vars['block'])) {
    $vars['blocktheme_vars'] = $custom_block_vars;
  }
}