public ImageStyleEditForm::effectSave($form, FormStateInterface $form_state)
Submit handler for image effect.
File
- core/modules/image/src/Form/ImageStyleEditForm.php, line 204
Class
- ImageStyleEditForm
- Controller for image style edit form.
Namespace
Drupal\image\Form
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | public function effectSave( $form , FormStateInterface $form_state ) { $this ->save( $form , $form_state ); // Check if this field has any configuration options. $effect = $this ->imageEffectManager->getDefinition( $form_state ->getValue( 'new' )); // Load the configuration form for this option. if ( is_subclass_of ( $effect [ 'class' ], '\Drupal\image\ConfigurableImageEffectInterface' )) { $form_state ->setRedirect( 'image.effect_add_form' , array ( 'image_style' => $this ->entity->id(), 'image_effect' => $form_state ->getValue( 'new' ), ), array ( 'query' => array ( 'weight' => $form_state ->getValue( 'weight' ))) ); } // If there's no form, immediately add the image effect. else { $effect = array ( 'id' => $effect [ 'id' ], 'data' => array (), 'weight' => $form_state ->getValue( 'weight' ), ); $effect_id = $this ->entity->addImageEffect( $effect ); $this ->entity->save(); if (! empty ( $effect_id )) { drupal_set_message( $this ->t( 'The image effect was successfully applied.' )); } } } |
Please login to continue.