You are here

public function GTranslateSettingsForm::submitForm in Translate Drupal with GTranslate 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

src/Form/GTranslateSettingsForm.php, line 129
Contains \Drupal\gtranslate\Form\GTranslateSettingsForm.

Class

GTranslateSettingsForm
Controller location for Live Weather Settings Form.

Namespace

Drupal\gtranslate\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_value = $form_state
    ->getValues();
  $this
    ->config('gtranslate.settings')
    ->set('gtranslate_pro', $form_value['gtranslate_pro'])
    ->set('gtranslate_enterprise', $form_value['gtranslate_enterprise'])
    ->set('gtranslate_analytics', $form_value['gtranslate_analytics'])
    ->set('gtranslate_look', $form_value['gtranslate_look'])
    ->set('gtranslate_flag_size', $form_value['gtranslate_flag_size'])
    ->set('gtranslate_new_window', $form_value['gtranslate_new_window'])
    ->set('gtranslate_main_lang', $form_value['gtranslate_main_lang'])
    ->save();
  foreach ($this->languages as $lang => $language) {
    $this
      ->config('gtranslate.settings')
      ->set('gtranslate_' . $lang, $form_value['gtranslate_' . $lang])
      ->save();
  }
  parent::submitForm($form, $form_state);
}