public function VarnishImagePurgeConfiguration::submitForm in Varnish purger 8
Same name and namespace in other branches
- 8.2 modules/varnish_image_purge/src/Form/VarnishImagePurgeConfiguration.php \Drupal\varnish_image_purge\Form\VarnishImagePurgeConfiguration::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
- modules/
varnish_image_purge/ src/ Form/ VarnishImagePurgeConfiguration.php, line 132
Class
- VarnishImagePurgeConfiguration
- Configure site information settings for this site.
Namespace
Drupal\varnish_image_purge\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('varnish_image_purge.configuration');
$values = [];
foreach ($form_state
->getValues() as $entity_type => $bundles) {
if (is_array($bundles)) {
foreach ($bundles as $bundle_id => $bundle) {
if ($bundle !== 0) {
$values[$entity_type][] = $bundle_id;
}
}
}
}
$config
->set('entity_types', $values);
$config
->save();
parent::submitForm($form, $form_state);
}