You are here

function locale_languages_edit_form_submit in Drupal 7

Same name and namespace in other branches
  1. 6 includes/locale.inc \locale_languages_edit_form_submit()

Process the language editing form submission.

Related topics

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

File

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;
}