You are here

function i18n_menu_node_block_view in Menu translation - Node 7

Implementation of hook_block_view().

Provide an i18n version of each menu block.

Since menu tree rendering is influenced by language selection modes we need to temporarily disable language selection.

File

./i18n_menu_node.module, line 102
Menu translation (Node).

Code

function i18n_menu_node_block_view($delta = '') {

  // A longer separator would risk exceed the delta column max length.
  $separator = I18N_MENU_NODE_BLOCK_SEPARATOR;
  list($module, $delta) = explode($separator, $delta, 2);
  $info = i18n_menu_node_block_info($module);
  if (!empty($info['file'])) {
    require_once $info['file'];
  }
  $block = NULL;

  // If a view callback is defined we use it, otherwise we fall back to the
  // usual hook_block_view() invocation.
  i18n_select(FALSE);
  if (!empty($info['view']) && function_exists($info['view'])) {
    $block = $info['view']($delta);
  }
  else {
    $block = module_invoke($module, 'block_view', $delta);
  }
  i18n_select(TRUE);
  return $block;
}