You are here

function stringoverrides_menu in String Overrides 7

Same name and namespace in other branches
  1. 5 stringoverrides.module \stringoverrides_menu()
  2. 6 stringoverrides.module \stringoverrides_menu()

Implements hook_menu().

File

./stringoverrides.module, line 51
Configuration interface to provide a quick and easy way of replacing text.

Code

function stringoverrides_menu() {
  $items['admin/config/regional/stringoverrides'] = array(
    'title' => 'String overrides',
    'description' => 'Provides a quick and easy way of replacing text on the site.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'stringoverrides_admin',
    ),
    'access arguments' => array(
      'administer string overrides',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'stringoverrides.admin.inc',
  );

  // Add the language tabs if there are other languages
  if (module_exists('locale')) {
    $language = language_default();
    $languages = locale_language_list();
    foreach ($languages as $code => $name) {
      $items["admin/config/regional/stringoverrides/manage/{$code}"] = array(
        'title' => '@lang',
        'title arguments' => array(
          '@lang' => $name,
        ),
        'page arguments' => array(
          'stringoverrides_admin',
          $code,
        ),
        'access arguments' => array(
          'administer string overrides',
        ),
        'type' => $language->language == $code ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
        'file' => 'stringoverrides.admin.inc',
      );
    }
  }
  else {
    $items['admin/config/regional/stringoverrides/manage/en'] = array(
      'title' => 'Overrides',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'stringoverrides_admin',
        'en',
      ),
      'access arguments' => array(
        'administer string overrides',
      ),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'file' => 'stringoverrides.admin.inc',
    );
  }
  return $items;
}