function ImageWidget::settingsForm

Same name in other branches
  1. 9 core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::settingsForm()
  2. 8.9.x core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::settingsForm()
  3. 11.x core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::settingsForm()

Overrides FileWidget::settingsForm

File

core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php, line 69

Class

ImageWidget
Plugin implementation of the 'image_image' widget.

Namespace

Drupal\image\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $element = parent::settingsForm($form, $form_state);
    $element['preview_image_style'] = [
        '#title' => $this->t('Preview image style'),
        '#type' => 'select',
        '#options' => image_style_options(FALSE),
        '#empty_option' => '<' . $this->t('no preview') . '>',
        '#default_value' => $this->getSetting('preview_image_style'),
        '#description' => $this->t('The preview image will be shown while editing the content.'),
        '#weight' => 15,
    ];
    return $element;
}

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