You are here

public function VideoEmbedThumbnailFormatter::settingsForm in Video 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/VideoEmbedThumbnailFormatter.php \Drupal\video\Plugin\Field\FieldFormatter\VideoEmbedThumbnailFormatter::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/VideoEmbedThumbnailFormatter.php, line 86

Class

VideoEmbedThumbnailFormatter
Plugin implementation of the thumbnail field formatter.

Namespace

Drupal\video\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $form['image_style'] = [
    '#title' => $this
      ->t('Image Style'),
    '#type' => 'select',
    '#default_value' => $this
      ->getSetting('image_style'),
    '#required' => TRUE,
    '#options' => image_style_options(),
  ];
  $form['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 $form;
}