You are here

public function JpegOptim::buildConfigurationForm in Image Optimize Binaries 8

Overrides ImageAPIOptimizeProcessorBinaryBase::buildConfigurationForm

File

src/Plugin/ImageAPIOptimizeProcessor/JpegOptim.php, line 76

Class

JpegOptim
Uses the JpegOptim binary to optimize images.

Namespace

Drupal\imageapi_optimize_binaries\Plugin\ImageAPIOptimizeProcessor

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildConfigurationForm($form, $form_state);
  $form['progressive'] = array(
    '#title' => $this
      ->t('Progressive'),
    '#type' => 'select',
    '#options' => array(
      '' => $this
        ->t('No change'),
      0 => $this
        ->t('Non-progressive'),
      1 => $this
        ->t('Progressive'),
    ),
    '#default_value' => $this->configuration['progressive'],
    '#description' => $this
      ->t('If "No change" is selected, the output will have the same as the input.'),
  );
  $form['quality'] = array(
    '#title' => $this
      ->t('Quality'),
    '#type' => 'number',
    '#min' => 0,
    '#max' => 100,
    '#description' => $this
      ->t('Optionally enter a JPEG quality setting to use, 0 - 100. WARNING: LOSSY'),
    '#default_value' => $this->configuration['quality'],
  );
  $form['size'] = array(
    '#title' => $this
      ->t('Target size'),
    '#type' => 'number',
    '#min' => 1,
    '#max' => 100,
    '#field_suffix' => '%',
    '#description' => $this
      ->t('Optionally enter a target percentage of filesize for optimisation. WARNING: LOSSY'),
    '#default_value' => $this->configuration['size'],
  );
  return $form;
}