function CropImageEffect::buildConfigurationForm

Same name and namespace in other branches
  1. 9 core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php \Drupal\image\Plugin\ImageEffect\CropImageEffect::buildConfigurationForm()
  2. 8.9.x core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php \Drupal\image\Plugin\ImageEffect\CropImageEffect::buildConfigurationForm()
  3. 11.x core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php \Drupal\image\Plugin\ImageEffect\CropImageEffect::buildConfigurationForm()

Overrides ResizeImageEffect::buildConfigurationForm

File

core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php, line 59

Class

CropImageEffect
Crops an image resource.

Namespace

Drupal\image\Plugin\ImageEffect

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildConfigurationForm($form, $form_state);
    $form['anchor'] = [
        '#type' => 'radios',
        '#title' => $this->t('Anchor'),
        '#options' => [
            'left-top' => $this->t('Top left'),
            'center-top' => $this->t('Top center'),
            'right-top' => $this->t('Top right'),
            'left-center' => $this->t('Center left'),
            'center-center' => $this->t('Center'),
            'right-center' => $this->t('Center right'),
            'left-bottom' => $this->t('Bottom left'),
            'center-bottom' => $this->t('Bottom center'),
            'right-bottom' => $this->t('Bottom right'),
        ],
        '#theme' => 'image_anchor',
        '#default_value' => $this->configuration['anchor'],
        '#description' => $this->t('The part of the image that will be retained during the crop.'),
    ];
    return $form;
}

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