class DefaultFileFormatter
Same name in other branches
- 9 core/modules/file/src/Plugin/Field/FieldFormatter/DefaultFileFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\DefaultFileFormatter
- 8.9.x core/modules/file/src/Plugin/Field/FieldFormatter/DefaultFileFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\DefaultFileFormatter
- 10 core/modules/file/src/Plugin/Field/FieldFormatter/DefaultFileFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\DefaultFileFormatter
Formatter for a text field on a file entity that links the field to the file.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\Core\Field\PluginSettingsBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Field\PluginSettingsInterface, \Drupal\Component\Plugin\DependentPluginInterface
- class \Drupal\Core\Field\FormatterBase extends \Drupal\Core\Field\PluginSettingsBase implements \Drupal\Core\Field\FormatterInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\file\Plugin\Field\FieldFormatter\BaseFieldFileFormatterBase extends \Drupal\Core\Field\FormatterBase
- class \Drupal\file\Plugin\Field\FieldFormatter\DefaultFileFormatter extends \Drupal\file\Plugin\Field\FieldFormatter\BaseFieldFileFormatterBase
- class \Drupal\file\Plugin\Field\FieldFormatter\BaseFieldFileFormatterBase extends \Drupal\Core\Field\FormatterBase
- class \Drupal\Core\Field\FormatterBase extends \Drupal\Core\Field\PluginSettingsBase implements \Drupal\Core\Field\FormatterInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\Core\Field\PluginSettingsBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Field\PluginSettingsInterface, \Drupal\Component\Plugin\DependentPluginInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of DefaultFileFormatter
File
-
core/
modules/ file/ src/ Plugin/ Field/ FieldFormatter/ DefaultFileFormatter.php, line 13
Namespace
Drupal\file\Plugin\Field\FieldFormatterView source
class DefaultFileFormatter extends BaseFieldFileFormatterBase {
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
$settings = parent::defaultSettings();
$settings['link_to_file'] = TRUE;
return $settings;
}
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
// We don't call the parent in order to bypass the link to file form.
return $form;
}
/**
* {@inheritdoc}
*/
protected function viewValue(FieldItemInterface $item) {
return $item->value;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.