You are here

public function GD::buildConfigurationForm in ImageAPI Optimize GD 8

Same name and namespace in other branches
  1. 2.x src/Plugin/ImageAPIOptimizeProcessor/GD.php \Drupal\imageapi_optimize_gd\Plugin\ImageAPIOptimizeProcessor\GD::buildConfigurationForm()

File

src/Plugin/ImageAPIOptimizeProcessor/GD.php, line 71

Class

GD
Provides a ImageAPI Optimize processor for GD.

Namespace

Drupal\imageapi_optimize_gd\Plugin\ImageAPIOptimizeProcessor

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form['quality'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Image quality'),
    '#description' => $this
      ->t('Specify the image quality.'),
    '#default_value' => $this->configuration['quality'],
    '#required' => TRUE,
    '#min' => 1,
    '#max' => 100,
  ];
  $form['file_types'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('File Types'),
    '#options' => [
      'image/jpeg' => 'JPEG',
      'image/webp' => 'WebP',
    ],
    '#default_value' => $this->configuration['file_types'],
    '#required' => TRUE,
  ];
  return $form;
}