function ImageStyleEditForm::effectValidate

Same name in other branches
  1. 9 core/modules/image/src/Form/ImageStyleEditForm.php \Drupal\image\Form\ImageStyleEditForm::effectValidate()
  2. 8.9.x core/modules/image/src/Form/ImageStyleEditForm.php \Drupal\image\Form\ImageStyleEditForm::effectValidate()
  3. 11.x core/modules/image/src/Form/ImageStyleEditForm.php \Drupal\image\Form\ImageStyleEditForm::effectValidate()

Validate handler for image effect.

File

core/modules/image/src/Form/ImageStyleEditForm.php, line 198

Class

ImageStyleEditForm
Controller for image style edit form.

Namespace

Drupal\image\Form

Code

public function effectValidate($form, FormStateInterface $form_state) {
    if (!$form_state->getValue('new')) {
        $form_state->setErrorByName('new', $this->t('Select an effect to add.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.