function l10n_update_admin_import_form_submit in Localization update 7
Same name and namespace in other branches
- 6 l10n_update.admin.inc \l10n_update_admin_import_form_submit()
Submit handler for Update form.
Handles both submit buttons to update translations and to update the form information.
1 call to l10n_update_admin_import_form_submit()
- drush_l10n_update_refresh in ./
l10n_update.drush.inc - Callback for command l10n-update-refresh.
File
- ./
l10n_update.admin.inc, line 134 - Admin settings and update page.
Code
function l10n_update_admin_import_form_submit($form, $form_state) {
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
$projects = l10n_update_get_projects();
if ($op == t('Update translations')) {
$languages = isset($form_state['values']['languages']) ? array_filter($form_state['values']['languages']) : NULL;
$updates = $form_state['values']['updates'];
$mode = variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP);
if ($projects && $updates) {
module_load_include('batch.inc', 'l10n_update');
// Filter out updates in other languages. If no languages, all of them will be updated
$updates = _l10n_update_prepare_updates($updates, NULL, $languages);
$batch = l10n_update_batch_multiple($updates, $mode);
batch_set($batch);
}
}
elseif ($op == t('Refresh information')) {
// Get current version of projects.
l10n_update_build_projects();
// Get available translation updates and update file history.
if ($available = l10n_update_available_releases(TRUE)) {
l10n_update_flag_history($available);
drupal_set_message(t('Fetched information about available updates from the server'));
}
else {
drupal_set_message(t('Failed to fetch information about available updates from the server.'), 'error');
}
}
}