getRegion(); if ($region !== 'footer') { return; } // Request wrapping the block title and content in appropriate classes. $build['#pre_render'][] = '_dr821_prerender_block'; // Wrap the overall block in panel classes. if (!isset($build['#attributes']['class'])) { $build['#attributes']['class'] = []; } $build['#dr821_panelize_title_va'] = TRUE; $build['#attributes']['class'] += ['panel', 'panel-default', 'col-xs-6']; } /** * Pre-render function to request wrapping of block parts. * * @param array $block * * @return mixed */ function _dr821_prerender_block($block) { // Wrap the block body in a panel-body container div. if (!empty($block['content'])) { $block['content']['#theme_wrappers'] = [ 'container' => [ '#attributes' => [ 'class' => ['panel-body'], ], ], ]; } // Tell the preprocess function to wrap the block title as a panel heading $block['#dr821_panelize_title'] = TRUE; return $block; } /** * Wrap the block title as a panel heading with title. * * @param array $elements */ function _dr821_panelize_block_title(&$elements) { // Do not just assign prefix/suffix: it would lose contextual information. $elements['title_prefix']['#markup'] = '