You are here

function l10n_update_admin_import_form in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.admin.inc \l10n_update_admin_import_form()

Translation update form.

@todo selectable packages @todo check language support in server @todo check file update dates

Parameters

$form_state: Form states array.

$projects: @todo $projects are not used in the form.

$updates: Updates to be displayed in the form.

1 string reference to 'l10n_update_admin_import_form'
l10n_update_admin_overview in ./l10n_update.admin.inc
Page callback: Admin overview page.

File

./l10n_update.admin.inc, line 81
Admin settings and update page.

Code

function l10n_update_admin_import_form($form, $form_state, $projects, $updates) {

  //module_load_include('inc', 'l10n_update');

  // For now we get package information provided by modules
  $projects = l10n_update_get_projects();
  $languages = l10n_update_language_list('name');

  // Absence of projects is an error and only occurs if the database table
  // was truncated. In this case we rebuild the project data.
  if (!$projects) {
    l10n_update_build_projects();
    $projects = l10n_update_get_projects();
  }
  if ($projects && $languages) {
    $form['updates'] = array(
      '#type' => 'value',
      '#value' => $updates,
    );
    if (count($languages) > 1) {
      $form['lang'] = array(
        '#type' => 'fieldset',
        '#title' => t('Languages'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#description' => t('Select one or more languages to download and update. If you select none, all of them will be updated.'),
      );
      $form['lang']['languages'] = array(
        '#type' => 'checkboxes',
        '#options' => $languages,
      );
    }
    if ($updates) {
      $form['actions']['download'] = array(
        '#type' => 'submit',
        '#value' => t('Update translations'),
      );
    }
  }
  $form['actions']['refresh'] = array(
    '#type' => 'submit',
    '#value' => t('Refresh information'),
  );
  return $form;
}