1 language.admin.inc language_admin_overview_form($form, &$form_state)

User interface for the language overview screen.

File

core/modules/language/language.admin.inc, line 11
Administration functions for language.module.

Code

function language_admin_overview_form($form, &$form_state) {
  backdrop_static_reset('language_list');
  $languages = language_list();
  $default = language_default();

  $form['languages'] = array(
    '#languages' => $languages,
    '#language_default' => $default,
    '#tree' => TRUE,
    '#header' => array(
      t('Name'),
      t('Enabled'),
      t('Default'),
      t('Weight'),
      t('Operations'),
    ),
    '#theme' => 'language_admin_overview_form_table',
  );

  foreach ($languages as $langcode => $language) {
    $form['languages'][$langcode]['#weight'] = $language->weight;
    $form['languages'][$langcode]['name'] = array(
      '#markup' => check_plain($language->name),
    );
    $form['languages'][$langcode]['enabled'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable @title', array('@title' => $language->name)),
      '#title_display' => 'invisible',
      '#default_value' => (int) $language->enabled,
      '#disabled' => $langcode == $default->langcode,
    );
    $form['languages'][$langcode]['default'] = array(
      '#type' => 'radio',
      '#parents' => array('site_default'),
      '#title' => t('Set @title as default', array('@title' => $language->name)),
      '#title_display' => 'invisible',
      '#return_value' => $langcode,
      '#default_value' => ($langcode == $default->langcode ? $langcode : NULL),
      '#id' => 'edit-site-default-' . $langcode,
    );
    $form['languages'][$langcode]['weight'] = 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'),
      ),
    );
    $links = array();
    $links['configure'] = array(
      'title' => t('Configure'),
      'href' => 'admin/config/regional/language/edit/' . $langcode,
    );
    if ($langcode != $default->langcode) {
      $links['delete'] = array(
        'title' => t('Delete'),
        'href' => 'admin/config/regional/language/delete/' . $langcode,
      );
    }
    $form['languages'][$langcode]['operations'] = array(
      '#type' => 'operations',
      '#links' => $links,
      '#weight' => 100,
    );
  }

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );

  return $form;
}