Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

i18nmenu_block

Definition

i18nmenu_block($op = 'list', $delta = 0)
contributions/i18n/i18nmenu/i18nmenu.module, line 81

Code

<?php
function i18nmenu_block($op = 'list', $delta = 0) {
  global $user;
  $menus = menu_get_menus();
  
  // unset($menus['navigation']);
  if ($op == 'list') {
    $blocks = array();
    foreach ($menus as $name => $title) {
      // Default "Navigation" block is handled by user.module.
      $blocks[$name]['info'] = check_plain($title).t('[Translated]');
      // Menu blocks can't be cached because each menu item can have
      // a custom access callback. menu.inc manages its own caching.
      $blocks[$name]['cache'] = BLOCK_NO_CACHE;
    }
    return $blocks;
  }
  else if ($op == 'view') {
    // The Navigation menu is handled like in the user module.
    if ($delta == 'navigation') {
      $data['subject'] = $user->uid ? check_plain($user->name) : t('Navigation');
    } else {
      $data['subject'] = check_plain($menus[$delta]);
    }
    $data['content'] = i18nmenu_translated_tree($delta);
    return $data;
  }  
}
?>