function ScaleImageEffect::validateConfigurationForm

Same name in other branches
  1. 9 core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php \Drupal\image\Plugin\ImageEffect\ScaleImageEffect::validateConfigurationForm()
  2. 8.9.x core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php \Drupal\image\Plugin\ImageEffect\ScaleImageEffect::validateConfigurationForm()
  3. 11.x core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php \Drupal\image\Plugin\ImageEffect\ScaleImageEffect::validateConfigurationForm()

Overrides ConfigurableImageEffectBase::validateConfigurationForm

File

core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php, line 82

Class

ScaleImageEffect
Scales an image resource.

Namespace

Drupal\image\Plugin\ImageEffect

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    parent::validateConfigurationForm($form, $form_state);
    if ($form_state->isValueEmpty('width') && $form_state->isValueEmpty('height')) {
        $form_state->setErrorByName('data', $this->t('Width and height can not both be blank.'));
    }
}

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