You are here

public function OembedProvidersSettingsForm::submitForm in oEmbed Providers 2.x

Same name and namespace in other branches
  1. 1.0.x src/Form/OembedProvidersSettingsForm.php \Drupal\oembed_providers\Form\OembedProvidersSettingsForm::submitForm()
  2. 1.1.x src/Form/OembedProvidersSettingsForm.php \Drupal\oembed_providers\Form\OembedProvidersSettingsForm::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/OembedProvidersSettingsForm.php, line 117

Class

OembedProvidersSettingsForm
Configure oEmbed settings form.

Namespace

Drupal\oembed_providers\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable('media.settings')
    ->set('oembed_providers_url', $form_state
    ->getValue('oembed_providers_url'))
    ->save();
  $this->configFactory
    ->getEditable(static::SETTINGS)
    ->set('external_fetch', (bool) $form_state
    ->getValue('external_fetch'))
    ->save();
  parent::submitForm($form, $form_state);
  $this->defaultCache
    ->delete('oembed_providers:oembed_providers');
}