You are here

protected function RetinaImageEffectTrait::prepareForm in Retina Images 8

Add the retinafy checkbox to the configuration options form.

Parameters

$form:

array $configuration:

1 call to RetinaImageEffectTrait::prepareForm()
RetinaImageEffectTrait::buildConfigurationForm in src/RetinaImageEffectTrait.php

File

src/RetinaImageEffectTrait.php, line 82
Provides shared helpers for all retina image effects.

Class

RetinaImageEffectTrait
Provides shared helpers for all retina image effects.

Namespace

Drupal\retina_images

Code

protected function prepareForm(&$form, array $configuration) {
  $form['retinafy'] = [
    '#type' => 'checkbox',
    '#default_value' => $configuration['retinafy'],
    '#title' => $this
      ->t('Retinafy'),
    '#description' => $this
      ->t('Scale and output this image with increased resolution. It is recommended to allow upscaling with this option and set image qualtiy to 25.'),
  ];
  $form['retina_multiplier'] = [
    '#type' => 'textfield',
    '#default_value' => $configuration['multiplier'],
    '#title' => $this
      ->t('Resolution multiplier'),
    '#description' => $this
      ->t('Specify a different resolution multiplier to be used when scaling the image.'),
    '#states' => [
      'visible' => [
        ':input[name="data[retinafy]"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
}