public function AllowedProvidersForm::submitForm in oEmbed Providers 1.0.x
Same name and namespace in other branches
- 1.1.x src/Form/AllowedProvidersForm.php \Drupal\oembed_providers\Form\AllowedProvidersForm::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/ AllowedProvidersForm.php, line 117
Class
- AllowedProvidersForm
- Configure allowed providers settings form.
Namespace
Drupal\oembed_providers\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$allowed_providers = [];
foreach ($form_state
->getValue('allowed_providers') as $provider) {
if ($provider) {
$allowed_providers[] = $provider;
}
}
$this->configFactory
->getEditable(static::SETTINGS)
->set('allowed_providers', $allowed_providers)
->save();
parent::submitForm($form, $form_state);
}