You are here

public function ConvertImageEffect::buildConfigurationForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/image/src/Plugin/ImageEffect/ConvertImageEffect.php \Drupal\image\Plugin\ImageEffect\ConvertImageEffect::buildConfigurationForm()
  2. 9 core/modules/image/src/Plugin/ImageEffect/ConvertImageEffect.php \Drupal\image\Plugin\ImageEffect\ConvertImageEffect::buildConfigurationForm()

File

core/modules/image/src/Plugin/ImageEffect/ConvertImageEffect.php, line 62

Class

ConvertImageEffect
Converts an image resource.

Namespace

Drupal\image\Plugin\ImageEffect

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $extensions = \Drupal::service('image.toolkit.manager')
    ->getDefaultToolkit()
    ->getSupportedExtensions();
  $options = array_combine($extensions, array_map('mb_strtoupper', $extensions));
  $form['extension'] = [
    '#type' => 'select',
    '#title' => t('Convert to'),
    '#default_value' => $this->configuration['extension'],
    '#required' => TRUE,
    '#options' => $options,
  ];
  return $form;
}