You are here

public function CropImageEffect::buildConfigurationForm in Drupal 10

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

File

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

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' => t('Anchor'),
    '#options' => [
      'left-top' => t('Top left'),
      'center-top' => t('Top center'),
      'right-top' => t('Top right'),
      'left-center' => t('Center left'),
      'center-center' => t('Center'),
      'right-center' => t('Center right'),
      'left-bottom' => t('Bottom left'),
      'center-bottom' => t('Bottom center'),
      'right-bottom' => t('Bottom right'),
    ],
    '#theme' => 'image_anchor',
    '#default_value' => $this->configuration['anchor'],
    '#description' => t('The part of the image that will be retained during the crop.'),
  ];
  return $form;
}