You are here

public function PngQuant::validateConfigurationForm in Image Optimize Binaries 8

File

src/Plugin/ImageAPIOptimizeProcessor/PngQuant.php, line 119

Class

PngQuant
Uses the PngQuant binary to optimize images.

Namespace

Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessor

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $quality = $form_state
    ->getValue('quality');
  if (isset($quality['min']) && $quality['max'] && $quality['min'] > $quality['max']) {
    $form_state
      ->setErrorByName('quality][min', $this
      ->t('Minimum quality should be less than or equal to the Maximum quality'));
  }
}