function BaseFieldFileFormatterBase::settingsForm

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

Overrides FormatterBase::settingsForm

3 calls to BaseFieldFileFormatterBase::settingsForm()
FileExtensionFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileExtensionFormatter.php
Returns a form to configure settings for the formatter.
FilemimeFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FilemimeFormatter.php
Returns a form to configure settings for the formatter.
FileUriFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileUriFormatter.php
Returns a form to configure settings for the formatter.
4 methods override BaseFieldFileFormatterBase::settingsForm()
DefaultFileFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/DefaultFileFormatter.php
Returns a form to configure settings for the formatter.
FileExtensionFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileExtensionFormatter.php
Returns a form to configure settings for the formatter.
FilemimeFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FilemimeFormatter.php
Returns a form to configure settings for the formatter.
FileUriFormatter::settingsForm in core/modules/file/src/Plugin/Field/FieldFormatter/FileUriFormatter.php
Returns a form to configure settings for the formatter.

File

core/modules/file/src/Plugin/Field/FieldFormatter/BaseFieldFileFormatterBase.php, line 82

Class

BaseFieldFileFormatterBase
Base class for file formatters, which allow to link to the file download URL.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    $form['link_to_file'] = [
        '#title' => $this->t('Link this field to the file download URL'),
        '#type' => 'checkbox',
        '#default_value' => $this->getSetting('link_to_file'),
    ];
    return $form;
}

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