You are here

function stringoverrides_menu in String Overrides 6

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

Implementation of hook_menu()

File

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

Code

function stringoverrides_menu() {
  $items = array();
  $items['admin/settings/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',
      3,
    ),
    'access arguments' => array(
      'administer string overrides',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'stringoverrides.admin.inc',
  );
  $items['admin/settings/stringoverrides/import'] = array(
    'title' => 'Import',
    'description' => 'Import a set of overrides from a *.po file.',
    'page arguments' => array(
      'stringoverrides_admin_import',
    ),
    'access arguments' => array(
      'administer string overrides',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 9,
  );
  $items['admin/settings/stringoverrides/export'] = array(
    'title' => 'Export',
    'description' => 'Import a set of overrides from a *.po file.',
    'page arguments' => array(
      'stringoverrides_admin_export',
    ),
    'access arguments' => array(
      'administer string overrides',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );

  // 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/settings/stringoverrides/{$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,
      );
    }
  }
  else {
    $items['admin/settings/stringoverrides/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',
    );
  }
  $items['admin/settings/stringoverrides/js'] = array(
    'title' => 'String Overrides Javascript',
    'page callback' => 'stringoverrides_js',
    'type' => MENU_CALLBACK,
    'file' => 'stringoverrides.admin.inc',
    'access arguments' => array(
      'administer string overrides',
    ),
  );
  return $items;
}