function DescriptionAwareFileFormatterBase::settingsForm

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

Overrides FormatterBase::settingsForm

File

core/modules/file/src/Plugin/Field/FieldFormatter/DescriptionAwareFileFormatterBase.php, line 26

Class

DescriptionAwareFileFormatterBase
Base class for file formatters that have to deal with file descriptions.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    $form['use_description_as_link_text'] = [
        '#title' => $this->t('Use description as link text'),
        '#description' => $this->t('Replace the file name by its description when available'),
        '#type' => 'checkbox',
        '#default_value' => $this->getSetting('use_description_as_link_text'),
    ];
    return $form;
}

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