function FileExtensionFormatter::isApplicable

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

Overrides BaseFieldFileFormatterBase::isApplicable

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileExtensionFormatter.php, line 70

Class

FileExtensionFormatter
Formatter to render a filename as file extension.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

public static function isApplicable(FieldDefinitionInterface $field_definition) {
    // Just show this file extension formatter on the filename field.
    return parent::isApplicable($field_definition) && $field_definition->getName() === 'filename';
}

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