You are here

function locale_languages_overview_form in Drupal 7

Same name and namespace in other branches
  1. 6 includes/locale.inc \locale_languages_overview_form()

User interface for the language overview screen.

Related topics

1 string reference to 'locale_languages_overview_form'
locale_menu in modules/locale/locale.module
Implements hook_menu().

File

modules/locale/locale.admin.inc, line 20
Administration functions for locale.module.

Code

function locale_languages_overview_form() {
  drupal_static_reset('language');
  $languages = language_list('language');
  $options = array();
  $form['weight'] = array(
    '#tree' => TRUE,
  );
  foreach ($languages as $langcode => $language) {
    $options[$langcode] = '';
    if ($language->enabled) {
      $enabled[] = $langcode;
    }
    $form['weight'][$langcode] = array(
      '#type' => 'weight',
      '#title' => t('Weight for @title', array(
        '@title' => $language->name,
      )),
      '#title_display' => 'invisible',
      '#default_value' => $language->weight,
      '#attributes' => array(
        'class' => array(
          'language-order-weight',
        ),
      ),
    );
    $form['name'][$langcode] = array(
      '#markup' => check_plain($language->name),
    );
    $form['native'][$langcode] = array(
      '#markup' => check_plain($language->native),
    );
    $form['direction'][$langcode] = array(
      '#markup' => $language->direction == LANGUAGE_RTL ? t('Right to left') : t('Left to right'),
    );
  }
  $form['enabled'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enabled languages'),
    '#title_display' => 'invisible',
    '#options' => $options,
    '#default_value' => $enabled,
  );
  $form['site_default'] = array(
    '#type' => 'radios',
    '#title' => t('Default language'),
    '#title_display' => 'invisible',
    '#options' => $options,
    '#default_value' => language_default('language'),
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['#theme'] = 'locale_languages_overview_form';
  return $form;
}