You are here

function i18n_admin_settings in Internationalization 5

Same name and namespace in other branches
  1. 5.3 i18n.module \i18n_admin_settings()
  2. 5.2 i18n.module \i18n_admin_settings()
  3. 6 i18n.admin.inc \i18n_admin_settings()

Form builder function.

Some options have been removed from previous versions:

  • Languages are now taken from locale module unless defined in settings file
  • Language dependent tables are authomatically used if defined in settings file
1 string reference to 'i18n_admin_settings'
i18n_menu in ./i18n.module
Implementation of hook_menu(). Modify rewriting conditions when viewing specific nodes

File

./i18n.module, line 270
Internationalization (i18n) module

Code

function i18n_admin_settings() {

  // Check languages
  $languages = variable_get('i18n_languages', array());
  if (!count($languages) || !count($languages['active']) > 1) {
    drupal_set_message(t('No languages enabled. Visit the !locale_admin page to set up your languages.', array(
      '!locale_admin' => l(t('Manage languages'), 'admin/settings/locale/'),
    )), 'error');
  }
  $form['i18n_browser'] = array(
    '#type' => 'radios',
    '#title' => t('Browser language detection'),
    '#default_value' => variable_get('i18n_browser', 0),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t("User browser language for home page and links without language prefix."),
  );

  // Language icons
  $form['icons'] = array(
    '#type' => 'fieldset',
    '#title' => t('Language icons settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['icons']['i18n_icon_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Language icons path'),
    '#default_value' => variable_get('i18n_icon_path', drupal_get_path('module', 'i18n') . '/flags/*.png'),
    '#size' => 70,
    '#maxlength' => 180,
    '#description' => t('Path for language icons, relative to Drupal installation. \'*\' is a placeholder for language code.'),
  );
  $form['icons']['i18n_icon_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Language icons size'),
    '#default_value' => variable_get('i18n_icon_size', '16x12'),
    '#size' => 10,
    '#maxlength' => 10,
    '#description' => t('Image size for language icons, in the form "width x height".'),
  );

  // Advanced options
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced']['i18n_selection_mode'] = array(
    '#type' => 'radios',
    '#title' => t('Content selection mode'),
    '#default_value' => variable_get('i18n_selection_mode', 'simple'),
    '#options' => _i18n_selection_mode(),
    '#description' => t('Determines which content to show depending on language.'),
  );
  return system_settings_form($form);
}