You are here

public function Thumbnail::settingsForm in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/Thumbnail.php \Drupal\video_embed_field\Plugin\Field\FieldFormatter\Thumbnail::settingsForm()

Returns a form to configure settings for the formatter.

Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

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 elements for the formatter settings.

Overrides FormatterBase::settingsForm

File

src/Plugin/Field/FieldFormatter/Thumbnail.php, line 136

Class

Thumbnail
Plugin implementation of the thumbnail field formatter.

Namespace

Drupal\video_embed_field\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element = parent::settingsForm($form, $form_state);
  $element['image_style'] = [
    '#title' => $this
      ->t('Image Style'),
    '#type' => 'select',
    '#default_value' => $this
      ->getSetting('image_style'),
    '#required' => FALSE,
    '#options' => image_style_options(),
  ];
  $element['link_image_to'] = [
    '#title' => $this
      ->t('Link image to'),
    '#type' => 'select',
    '#empty_option' => $this
      ->t('- None -'),
    '#default_value' => $this
      ->getSetting('link_image_to'),
    '#options' => [
      static::LINK_CONTENT => $this
        ->t('Content'),
      static::LINK_PROVIDER => $this
        ->t('Provider URL'),
    ],
  ];
  return $element;
}