Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ImageWidget.php

function 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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal