public static function PhotosAlbumCoverImageFormatter::isApplicable in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Plugin/Field/FieldFormatter/PhotosAlbumCoverImageFormatter.php \Drupal\photos\Plugin\Field\FieldFormatter\PhotosAlbumCoverImageFormatter::isApplicable()
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/ PhotosAlbumCoverImageFormatter.php, line 86
Class
- PhotosAlbumCoverImageFormatter
- Plugin implementation of the 'media_thumbnail' formatter.
Namespace
Drupal\photos\Plugin\Field\FieldFormatterCode
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// This formatter is only available for image file fields in the
// photos_image entity.
$type = $field_definition
->getType();
$entityType = $field_definition
->getTargetEntityTypeId();
$targetType = $field_definition
->getFieldStorageDefinition()
->getSetting('target_type');
return $entityType == 'photos_image' && $type == 'image' && $targetType == 'file';
}