public static function FileSizeFormatter::isApplicable in File Entity (fieldable files) 8.2
Returns if the formatter can be used for the provided field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition that should be checked.
Return value
bool TRUE if the formatter can be used, FALSE otherwise.
Overrides FormatterBase::isApplicable
File
- src/
Plugin/ Field/ FieldFormatter/ FileSizeFormatter.php, line 26
Class
- FileSizeFormatter
- Implementation of the 'filesize' formatter for the file_entity files.
Namespace
Drupal\file_entity\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// This formatter is only available for files.
return $field_definition
->getTargetEntityTypeId() == 'file';
}