function blocktheme_preprocess_block_admin_display_form in Block Theme 7
Same name and namespace in other branches
- 6 blocktheme.module \blocktheme_preprocess_block_admin_display_form()
Implements template_preprocess_block_admin_display_form().
File
- ./
blocktheme.module, line 333 - Provides a configuration option to select custom themes for blocks
Code
function blocktheme_preprocess_block_admin_display_form(&$variables) {
if (variable_get('blocktheme_show_custom_block_theme', '')) {
// Get blocks with custom templates.
$blocktheme = blocktheme_get();
// Get block theme names.
$blocktheme_themes = blocktheme_get_blockthemes();
// Add each block in the form to the appropriate place in the block listing.
foreach (element_children($variables['form']['blocks']) as $i) {
$block =& $variables['form']['blocks'][$i];
// Fetch the region for the current block.
$region = isset($block['region']['#default_value']) ? $block['region']['#default_value'] : BLOCK_REGION_NONE;
// Set block theme key for the current module.
$var_name = $block['module']['#value'] . '-' . $block['delta']['#value'];
$variables['block_listing'][$region][$i]->custom_block_theme = isset($blocktheme[$var_name]) ? $blocktheme_themes[$blocktheme[$var_name]] : '';
}
}
}