function icon_block_preprocess_block in Icon API 8
Same name and namespace in other branches
- 7 modules/icon_block/icon_block.module \icon_block_preprocess_block()
Implements hook_preprocess_block().
Add icon to blocks if necessary.
File
- modules/
icon_block/ icon_block.module, line 57 - icon_block.module Provides icon integration with blocks.
Code
function icon_block_preprocess_block(&$variables) {
$block =& $variables['block'];
// @FIXME line below was...
// $settings = icon_block_get_settings($block);
$settings = array_merge(icon_block_defaults(), isset($block->icon) ? (array) unserialize($block->icon) : array());
if (!empty($settings['bundle']) && !empty($settings['icon'])) {
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// if ($icon = theme('icon', array('bundle' => $settings['bundle'], 'icon' => $settings['icon']))) {
// $variables['classes_array'][] = 'has-icon';
// switch ($settings['position']) {
// case 'title_before':
// $variables['title_prefix'][] = array('#markup' => $icon);
// break;
//
// case 'title_after':
// $variables['title_suffix'][] = array('#markup' => $icon);
// break;
//
// case 'title_inside_before':
// $block->subject = $icon . $block->subject;
// break;
//
// case 'title_inside_after':
// $block->subject .= $icon;
// break;
//
// case 'content_before':
// $variables['content'] = $icon . $variables['content'];
// break;
//
// case 'content_after':
// $variables['content'] .= $icon;
// break;
// }
// }
}
}