You are here

private function FileAndImageTableFormatter::isImage in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
  2. 10.0.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_core\Plugin\Field\FieldFormatter\FileAndImageTableFormatter::isImage()
  3. 10.1.x modules/social_features/social_core/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php \Drupal\social_core\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_core/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php
Builds a renderable array for a field value.

File

modules/social_features/social_core/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php, line 73

Class

FileAndImageTableFormatter
Plugin implementation of the 'file_image_default' formatter.

Namespace

Drupal\social_core\Plugin\Field\FieldFormatter

Code

private function isImage(FileInterface $file) {
  $image = $this
    ->getImage($file);
  if ($image === NULL) {
    return FALSE;
  }
  return $image
    ->isValid();
}