function FileMediaFormatterBase::settingsForm

Same name in other branches
  1. 8.9.x core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::settingsForm()
  2. 10 core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::settingsForm()
  3. 11.x core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::settingsForm()

Overrides FormatterBase::settingsForm

1 call to FileMediaFormatterBase::settingsForm()
FileVideoFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php
Returns a form to configure settings for the formatter.
1 method overrides FileMediaFormatterBase::settingsForm()
FileVideoFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php
Returns a form to configure settings for the formatter.

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php, line 43

Class

FileMediaFormatterBase
Base class for media file formatter.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    return [
        'controls' => [
            '#title' => $this->t('Show playback controls'),
            '#type' => 'checkbox',
            '#default_value' => $this->getSetting('controls'),
        ],
        'autoplay' => [
            '#title' => $this->t('Autoplay'),
            '#type' => 'checkbox',
            '#default_value' => $this->getSetting('autoplay'),
        ],
        'loop' => [
            '#title' => $this->t('Loop'),
            '#type' => 'checkbox',
            '#default_value' => $this->getSetting('loop'),
        ],
        'multiple_file_display_type' => [
            '#title' => $this->t('Display of multiple files'),
            '#type' => 'radios',
            '#options' => [
                'tags' => $this->t('Use multiple @tag tags, each with a single source.', [
                    '@tag' => '<' . $this->getHtmlTag() . '>',
                ]),
                'sources' => $this->t('Use multiple sources within a single @tag tag.', [
                    '@tag' => '<' . $this->getHtmlTag() . '>',
                ]),
            ],
            '#default_value' => $this->getSetting('multiple_file_display_type'),
        ],
    ];
}

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