function FilemimeFormatter::settingsForm

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

Overrides BaseFieldFileFormatterBase::settingsForm

File

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

Class

FilemimeFormatter
Formatter to render the file MIME type, with an optional icon.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    $form['filemime_image'] = [
        '#title' => $this->t('Display an icon'),
        '#description' => $this->t('The icon is representing the file type, instead of the MIME text (such as "image/jpeg")'),
        '#type' => 'checkbox',
        '#default_value' => $this->getSetting('filemime_image'),
    ];
    return $form;
}

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