public function ImageEffectFormBase::submitForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/image/src/Form/ImageEffectFormBase.php \Drupal\image\Form\ImageEffectFormBase::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 FormInterface::submitForm
File
- core/
modules/ image/ src/ Form/ ImageEffectFormBase.php, line 113
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 (!$this->imageEffect
->getUuid()) {
$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'));
}