You are here

public function AllowIframedSiteConfigForm::submitForm in Allow site iframing 8

Same name and namespace in other branches
  1. 3.0.x src/Form/AllowIframedSiteConfigForm.php \Drupal\allow_iframed_site\Form\AllowIframedSiteConfigForm::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/AllowIframedSiteConfigForm.php, line 71

Class

AllowIframedSiteConfigForm

Namespace

Drupal\allow_iframed_site\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('allow_iframed_site.settings');
  foreach ($this->conditions as $key => $condition) {
    $condition
      ->submitConfigurationForm($form, $form_state);
    $config
      ->set($key, $condition
      ->getConfiguration());
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);

  // @TODO there should be a better way to invalidate the page cache.
  // but chances are this config will change rarely and be used on smaller sites.
  drupal_flush_all_caches();
}