You are here

function admin_language_settings in Administration Language 7

Same name and namespace in other branches
  1. 6 admin_language.module \admin_language_settings()

Settings form.

1 string reference to 'admin_language_settings'
admin_language_menu in ./admin_language.module
Implements hook_menu().

File

./admin_language.module, line 395
Makes admin pages be displayed in the administrator's preferred language.

Code

function admin_language_settings() {
  $form = array();
  $options = array(
    ADMIN_LANGUAGE_BLACKLIST => t('Use administration language on every page except the listed pages.'),
    ADMIN_LANGUAGE_WHITELIST => t('Use administration language on only the listed pages.'),
  );
  $args = array(
    '%admin' => 'admin',
    '%admin-wildcard' => 'admin/*',
    '%front' => '<front>',
  );
  $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %admin for the admin dashboard and %admin-wildcard for all administration pages. %front is the front page.", $args);
  $form['admin_language']['admin_language_visibility'] = array(
    '#type' => 'radios',
    '#title' => t('Use administration language on specific pages'),
    '#options' => $options,
    '#default_value' => variable_get('admin_language_visibility', ADMIN_LANGUAGE_WHITELIST),
  );
  $form['admin_language']['admin_language_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('admin_language_pages', ADMIN_LANGUAGE_DEFAULT_PAGES),
    '#description' => $description,
  );
  $form['admin_language']['core_admin_paths'] = array(
    '#type' => 'fieldset',
    '#title' => t('Use paths provided by core'),
    '#description' => t('Core modules to registers administrative paths (see <a href="https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_admin_paths/7">hook_admin_paths()</a> for further information).<br />Below you find a list of the paths and the option to toggle if this module should rely on those.<br /><br />'),
  );
  $form['admin_language']['core_admin_paths']['admin_language_use_path_is_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use admin paths provided by core'),
    '#default_value' => variable_get('admin_language_use_path_is_admin', TRUE),
  );
  $patterns = path_get_admin_paths();

  // Refresh the stored core admin paths. See admin_language_cron() for
  // documentation why this is necessary.
  variable_set('admin_language_path_is_admin_paths', $patterns);
  $form['admin_language']['core_admin_paths']['list']['admin'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Registered administrative paths'),
    '#description' => nl2br($patterns['admin']),
  );
  $form['admin_language']['core_admin_paths']['list']['non_admin'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Registered non-administrative paths'),
    '#description' => nl2br($patterns['non_admin']),
  );
  $form['admin_language_hide_user'] = array(
    '#type' => 'radios',
    '#title' => t('Hide administration language on user form'),
    '#description' => t('Select this option if you want to exclude the admin language from the language selection widget on the user edit form.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_hide_user', 0),
  );
  $form['admin_language_hide_node'] = array(
    '#type' => 'radios',
    '#title' => t('Hide administration language on node form'),
    '#description' => t('Select this option if you want to exclude the admin language from the language selection widget on the node edit form.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_hide_node', 0),
  );
  $form['admin_language_force_default'] = array(
    '#type' => 'radios',
    '#title' => t('Force use of default language'),
    '#description' => t('Select this option if you want to force the use of the default language on the node edit form. This setting overrides the <em>Hide admin language on user form</em> setting.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_force_default', 0),
  );
  $form['admin_language_force_neutral'] = array(
    '#type' => 'radios',
    '#title' => t('Force language neutral aliases'),
    '#description' => t('Select this option if you want to force the use of language neutral URL aliases. In some cases (for example, if you only use an administration language and a site language) this can help make aliases more consistent.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_force_neutral', 0),
  );
  if (module_exists('admin_menu') || module_exists('admin')) {
    $form['admin_language_translate_admin_menu'] = array(
      '#type' => 'radios',
      '#title' => t('Use administration language in the administration menu'),
      '#description' => t('Select this option if you want to display the administration menu using the administration language on all pages.'),
      '#options' => array(
        t('Disabled'),
        t('Enabled'),
      ),
      '#default_value' => variable_get('admin_language_translate_admin_menu', 0),
    );
  }
  $form['admin_language_force_cli'] = array(
    '#type' => 'radios',
    '#title' => t('Use administration language in cli mode'),
    '#description' => t('Select this option if you want to force using the administration language on all cli requests.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_force_cli', 0),
  );
  if (module_exists('toolbar')) {
    $form['admin_language_translate_toolbar'] = array(
      '#type' => 'radios',
      '#title' => t('Use administration language for the core toolbar'),
      '#description' => t('Select this option if you want to display the core toolbar using the administration language on all pages.'),
      '#options' => array(
        t('Disabled'),
        t('Enabled'),
      ),
      '#default_value' => variable_get('admin_language_translate_toolbar', 0),
    );
  }
  $form['admin_language_translate_local_tasks'] = array(
    '#type' => 'radios',
    '#title' => t('Translate local tasks'),
    '#description' => t('Select this option if you would like to translate local task links, such as "View" and "Edit" tabs.'),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#default_value' => variable_get('admin_language_translate_local_tasks', 0),
  );
  return system_settings_form($form);
}