private function FileAndImageTableFormatter::getImage in Open Social 8.6
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::getImage()
- 8.5 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::getImage()
- 8.7 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::getImage()
- 8.8 modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_comment_upload\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::getImage()
Grab the Image if we are dealing with one.
Parameters
\Drupal\file\FileInterface $file: A file entity. This function may resize the file affecting its size.
Return value
\Drupal\Core\Image\ImageInterface An Image object.
2 calls to FileAndImageTableFormatter::getImage()
- FileAndImageTableFormatter::isImage in modules/
social_features/ social_comment_upload/ src/ Plugin/ Field/ FieldFormatter/ FileAndImageTableFormatter.php - Check if its a file or image so we know what to render.
- 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 91
Class
- FileAndImageTableFormatter
- Plugin implementation of the 'file_image_default' formatter.
Namespace
Drupal\social_comment_upload\Plugin\Field\FieldFormatterCode
private function getImage(FileInterface $file) {
// Make sure we deal with a file.
$image_factory = \Drupal::service('image.factory');
return $image_factory
->get($file
->getFileUri());
}