You are here

function i18n_block_block_view_alter in Internationalization 7

Implements hook_block_view_alter().

File

i18n_block/i18n_block.module, line 116
Internationalization (i18n) submodule: Multilingual meta-blocks

Code

function i18n_block_block_view_alter(&$data, $block) {
  if (!empty($block->i18n_mode)) {
    if (!empty($block->title) && $block->title != '<none>') {

      // Unfiltered, as $block->subject will be created later from the title.
      $data['title'] = i18n_string(array(
        'blocks',
        $block->module,
        $block->delta,
        'title',
      ), $block->title, array(
        'sanitize' => FALSE,
      ));
    }
    if ($block->module == 'block' && isset($data['content'])) {
      $data['content'] = i18n_string(array(
        'blocks',
        $block->module,
        $block->delta,
        'body',
      ), $data['content']);
    }
  }
}