You are here

public function AmpSettingsForm::submitForm in Accelerated Mobile Pages (AMP) 8.3

Same name and namespace in other branches
  1. 8 src/Form/AmpSettingsForm.php \Drupal\amp\Form\AmpSettingsForm::submitForm()
  2. 8.2 src/Form/AmpSettingsForm.php \Drupal\amp\Form\AmpSettingsForm::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/AmpSettingsForm.php, line 299

Class

AmpSettingsForm
Defines the configuration export form.

Namespace

Drupal\amp\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // AMP theme settings.
  $amptheme = $form_state
    ->getValue('amptheme');
  $amptheme_config = $this
    ->config('amp.theme');
  $amptheme_config
    ->setData([
    'amptheme' => $amptheme,
  ]);
  $amptheme_config
    ->save();
  $amp_config = $this
    ->config('amp.settings');
  $amp_config
    ->set('process_full_html', $form_state
    ->getValue('process_full_html'))
    ->save();
  $amp_config
    ->set('amp_everywhere', $form_state
    ->getValue('amp_everywhere'))
    ->save();
  $amp_config
    ->set('show_extra_save_buttons', $form_state
    ->getValue('show_extra_save_buttons'))
    ->save();
  parent::submitForm($form, $form_state);
}