You are here

public function ImageThumbnail::settingsForm in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php \Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay\ImageThumbnail::settingsForm()

Returns a form to configure settings for the plugin.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form definition for the widget settings.

Overrides FieldWidgetDisplayBase::settingsForm

File

src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php, line 77

Class

ImageThumbnail
Displays image thumbnail.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\FieldWidgetDisplay

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $options = [];
  foreach ($this->entityTypeManager
    ->getStorage('image_style')
    ->loadMultiple() as $id => $image_style) {
    $options[$id] = $image_style
      ->label();
  }
  return [
    'image_style' => [
      '#type' => 'select',
      '#title' => $this
        ->t('Image style'),
      '#description' => $this
        ->t('Select image style to be used to display thumbnails.'),
      '#default_value' => $this->configuration['image_style'],
      '#options' => $options,
    ],
  ];
}