function globallink_locale_submit in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink_locale_mapping.inc \globallink_locale_submit()
- 7.6 globallink_locale_mapping.inc \globallink_locale_submit()
Handles submission of globallink_locale form.
File
- ./
globallink_locale_mapping.inc, line 155 - Globallink_locale_mapping.inc is a file that contains most functions needed on the Locale Mapping UI.
Code
function globallink_locale_submit($form, &$form_state) {
module_load_include('inc', 'globallink', 'globallink');
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
if ($op == t('Add')) {
$drupal_seleced_locale = $form_state['values']['drupal_locale_list'];
$drupal_locale = explode('|', $drupal_seleced_locale);
$locale_code = $form_state['values']['tpt_locale_list'];
globallink_add_locale_mapping($drupal_locale[0], $drupal_locale[1], $locale_code);
drupal_set_message(t('Mapping added successfully.'));
}
else {
$locales_arr = array_filter($form_state['values']['table']);
foreach ($locales_arr as $locale) {
$locale_name = globallink_get_drupal_locale_name($locale);
if (globallink_check_no_pending_submission($locale)) {
globallink_delete_locale_mapping($locale);
drupal_set_message(t('@locale mapping deleted successfully.', array(
'@locale' => check_plain($locale_name),
)));
}
else {
form_set_error('', t('@locale mapping cannot be deleted because there is a pending submission.', array(
'@locale' => check_plain($locale_name),
)));
}
}
}
}