3 namespace Drupal\file\Plugin\Field\FieldFormatter;
5 use Drupal\Core\Field\FieldItemInterface;
6 use Drupal\Core\Form\FormStateInterface;
9 * Formatter for a text field on a file entity that links the field to the file.
13 * label = @Translation("File link"),
19 class DefaultFileFormatter extends BaseFieldFileFormatterBase {
24 public static function defaultSettings() {
25 $settings = parent::defaultSettings();
26 $settings['link_to_file'] = TRUE;
34 public function settingsForm(array $form, FormStateInterface $form_state) {
35 // We don't call the parent in order to bypass the link to file form.
42 protected function viewValue(FieldItemInterface $item) {