public static function MediaResponsiveThumbnailFormatter::isApplicable in Media Responsive Thumbnail 8
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/ MediaResponsiveThumbnailFormatter.php, line 188
Class
- MediaResponsiveThumbnailFormatter
- Plugin implementation of the 'media_responsive_thumbnail' formatter.
Namespace
Drupal\media_responsive_thumbnail\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// This formatter is only available for entity types that reference
// media items.
return $field_definition
->getFieldStorageDefinition()
->getSetting('target_type') == 'media';
}