You are here

function tmgmt_ui_menu_alter in Translation Management Tool 7

Implements hook_menu_alter().

File

ui/tmgmt_ui.module, line 94
Common Translation managment UI.

Code

function tmgmt_ui_menu_alter(&$items) {
  $weight = NULL;
  $default_path = NULL;

  // Look for the sources overview local task with the lowest weight.
  foreach ($items as $path => $item) {
    $item += array(
      'weight' => 0,
    );
    if (strpos($path, 'admin/tmgmt/sources') !== FALSE) {
      if ($weight === NULL || $weight > $item['weight']) {
        $weight = $item['weight'];
        $default_path = $path;
      }
    }
  }

  // If we have found a default path, define a parent menu item based on it's
  // definitions and change the type to a default local task.
  if ($default_path) {
    $items['admin/tmgmt/sources'] = array(
      'title' => 'Sources',
      'description' => 'Source overview',
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
    ) + $items[$default_path];
    $items[$default_path]['type'] = MENU_DEFAULT_LOCAL_TASK;
  }
}