You are here

function i18n_variable_form_submit in Internationalization 5.2

Same name and namespace in other branches
  1. 5.3 i18n.module \i18n_variable_form_submit()
  2. 5 i18n.module \i18n_variable_form_submit()
  3. 6 i18n.module \i18n_variable_form_submit()

Save multilingual variables and remove them from form

File

./i18n.module, line 1004
Internationalization (i18n) module

Code

function i18n_variable_form_submit($form_id, $form_values) {
  $op = isset($form_values['op']) ? $form_values['op'] : '';
  $variables = variable_get('i18n_variables', array());
  $language = i18n_get_lang();
  foreach ($form_values as $key => $value) {
    if (in_array($key, $variables)) {
      if ($op == t('Reset to defaults')) {
        i18n_variable_del($key, $language);
      }
      else {
        if (is_array($value) && isset($form_values['array_filter'])) {
          $value = array_keys(array_filter($value));
        }
        i18n_variable_set($key, $value, $language);
      }
      unset($form_values[$key]);
    }
  }

  // Re-submit form
  system_settings_form_submit($form_id, $form_values);
}