You are here

function _webform_localization_webform_configure_form_submit_i18n_tweaks in Webform Localization 7

Same name and namespace in other branches
  1. 7.4 webform_localization.module \_webform_localization_webform_configure_form_submit_i18n_tweaks()

Handle translated element tweaks in Webform Configure Form.

1 string reference to '_webform_localization_webform_configure_form_submit_i18n_tweaks'
webform_localization_form_webform_configure_form_alter in ./webform_localization.module
Implements hook_form_FORM_ID_alter().

File

./webform_localization.module, line 483
Webform localization module.

Code

function _webform_localization_webform_configure_form_submit_i18n_tweaks($form, &$form_state) {
  global $language;
  $default_language = language_default();
  if ($default_language->language != $language->language) {

    // Webform Configure Form not in default language.
    module_load_include('inc', 'webform_localization', 'includes/webform_localization.i18n');
    $name = webform_localization_i18n_string_name($form['#node']->webform['nid'], 'confirmation');
    $string_source = i18n_string_get_string($name);
    $string_translation = $form_state['values']['confirmation']['value'];

    // We reset the source string value before saving the form.
    $form_state['values']['confirmation']['value'] = $string_source
      ->get_string();

    // We save the translated string using i18n string.
    i18n_string_translation_update($name, $string_translation, $language->language);
  }
}