You are here

function i18n_menu_block_view_alter in Internationalization 7

Implements hook_block_view().

File

i18n_menu/i18n_menu.module, line 79
Internationalization (i18n) submodule: Menu translation.

Code

function i18n_menu_block_view_alter(&$data, $block) {
  if (($block->module == 'menu' || $block->module == 'system') && i18n_menu_mode($block->delta) & I18N_MODE_MULTIPLE) {
    $menus = menu_get_menus();
    if (isset($menus[$block->delta])) {
      if (empty($block->title)) {
        $data['subject'] = i18n_string_plain(array(
          'menu',
          'menu',
          $block->delta,
          'title',
        ), $menus[$block->delta]);
      }

      // Add contextual links for this block.
      if (!empty($data['content'])) {
        $data['content']['#contextual_links']['menu'] = array(
          'admin/structure/menu/manage',
          array(
            $block->delta,
          ),
        );
      }
    }
  }
}