function ImageEffectFormBase::submitForm
Same name in other branches
- 9 core/modules/image/src/Form/ImageEffectFormBase.php \Drupal\image\Form\ImageEffectFormBase::submitForm()
- 8.9.x core/modules/image/src/Form/ImageEffectFormBase.php \Drupal\image\Form\ImageEffectFormBase::submitForm()
- 10 core/modules/image/src/Form/ImageEffectFormBase.php \Drupal\image\Form\ImageEffectFormBase::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ image/ src/ Form/ ImageEffectFormBase.php, line 117
Class
- ImageEffectFormBase
- Provides a base form for image effects.
Namespace
Drupal\image\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state->cleanValues();
// The image effect configuration is stored in the 'data' key in the form,
// pass that through for submission.
$this->imageEffect
->submitConfigurationForm($form['data'], SubformState::createForSubform($form['data'], $form, $form_state));
$this->imageEffect
->setWeight($form_state->getValue('weight'));
if ($uuid = $this->imageEffect
->getUuid()) {
$this->imageStyle
->getEffect($uuid)
->setConfiguration($this->imageEffect
->getConfiguration());
}
else {
$this->imageStyle
->addImageEffect($this->imageEffect
->getConfiguration());
}
$this->imageStyle
->save();
$this->messenger()
->addStatus($this->t('The image effect was successfully applied.'));
$form_state->setRedirectUrl($this->imageStyle
->toUrl('edit-form'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.