function locale_languages_edit_form_submit

7.x locale.admin.inc locale_languages_edit_form_submit($form, &$form_state)
6.x locale.inc locale_languages_edit_form_submit($form, &$form_state)

Process the language editing form submission.

Related topics

1 string reference to 'locale_languages_edit_form_submit'
locale_languages_edit_form in drupal-7.x/modules/locale/locale.admin.inc
Editing screen for a particular language.

File

drupal-7.x/modules/locale/locale.admin.inc, line 404
Administration functions for locale.module.

Code

function locale_languages_edit_form_submit($form, &$form_state) {
  db_update('languages')
    ->fields(array(
      'name' => $form_state['values']['name'],
      'native' => $form_state['values']['native'],
      'domain' => $form_state['values']['domain'],
      'prefix' => $form_state['values']['prefix'],
      'direction' => $form_state['values']['direction'],
    ))
    ->condition('language', $form_state['values']['langcode'])
    ->execute();
  $default = language_default();
  if ($default->language == $form_state['values']['langcode']) {
    $properties = array('name', 'native', 'direction', 'enabled', 'plurals', 'formula', 'domain', 'prefix', 'weight');
    foreach ($properties as $keyname) {
      if (isset($form_state['values'][$keyname])) {
        $default->$keyname = $form_state['values'][$keyname];
      }
    }
    variable_set('language_default', $default);
  }
  $form_state['redirect'] = 'admin/config/regional/language';
  return;
}