function ConvertImageEffect::buildConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/image/src/Plugin/ImageEffect/ConvertImageEffect.php \Drupal\image\Plugin\ImageEffect\ConvertImageEffect::buildConfigurationForm()
  2. 10 core/modules/image/src/Plugin/ImageEffect/ConvertImageEffect.php \Drupal\image\Plugin\ImageEffect\ConvertImageEffect::buildConfigurationForm()
  3. 11.x 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' => $this->t('Convert to'),
        '#default_value' => $this->configuration['extension'],
        '#required' => TRUE,
        '#options' => $options,
    ];
    return $form;
}

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