private function FileAndImageTableFormatter::isImage in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
- 8.5 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
- 8.6 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
- 8.7 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
Check if its a file or image so we know what to render.
Parameters
\Drupal\file\FileInterface $file: A file entity. This function may resize the file affecting its size.
Return value
bool TRUE when it's an image and not a file
1 call to FileAndImageTableFormatter::isImage()
- FileAndImageTableFormatter::viewElements in modules/
social_features/ social_comment_upload/ src/ Plugin/ Field/ FieldFormatter/ FileAndImageTableFormatter.php - Builds a renderable array for a field value.
File
- modules/
social_features/ social_comment_upload/ src/ Plugin/ Field/ FieldFormatter/ FileAndImageTableFormatter.php, line 72
Class
- FileAndImageTableFormatter
- Plugin implementation of the 'file_image_default' formatter.
Namespace
Drupal\social_comment_upload\Plugin\Field\FieldFormatterCode
private function isImage(FileInterface $file) {
$image = $this
->getImage($file);
if ($image === NULL) {
return FALSE;
}
return $image
->isValid();
}