You are here

public function BackToTopSettingsForm::submitForm in Back To Top 8

Same name and namespace in other branches
  1. 2.x src/Form/BackToTopSettingsForm.php \Drupal\back_to_top\Form\BackToTopSettingsForm::submitForm()

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/BackToTopSettingsForm.php, line 156

Class

BackToTopSettingsForm
Administration settings form.

Namespace

Drupal\back_to_top\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable('back_to_top.settings');
  $form_values = $form_state
    ->getValues();
  $config
    ->set('back_to_top_prevent_on_mobile', $form_values['back_to_top_prevent_on_mobile'])
    ->set('back_to_top_prevent_in_admin', $form_values['back_to_top_prevent_in_admin'])
    ->set('back_to_top_prevent_in_front', $form_values['back_to_top_prevent_in_front'])
    ->set('back_to_top_button_trigger', $form_values['back_to_top_button_trigger'])
    ->set('back_to_top_button_place', $form_values['back_to_top_button_place'])
    ->set('back_to_top_button_text', $form_values['back_to_top_button_text'])
    ->set('back_to_top_button_type', $form_values['back_to_top_button_type'])
    ->set('back_to_top_bg_color', $form_values['back_to_top_bg_color'])
    ->set('back_to_top_border_color', $form_values['back_to_top_border_color'])
    ->set('back_to_top_hover_color', $form_values['back_to_top_hover_color'])
    ->set('back_to_top_text_color', $form_values['back_to_top_text_color'])
    ->save();
  parent::submitForm($form, $form_state);
}