You are here

public function BlazyVideoTrait::getImageItem in Blazy 7

Gets the faked image item out of file entity, or ER, if applicable.

This should only be called for type video as file image has all the needed info to get the image from.

@todo merge it into self::getMediaItem()

Parameters

object $file: The expected file entity, or ER, to get image item from.

Return value

array The array of image item and settings if a file image, else empty.

2 calls to BlazyVideoTrait::getImageItem()
BlazyFileFormatter::buildElement in src/Plugin/Field/FieldFormatter/BlazyFileFormatter.php
Build individual item if so configured such as for file entity goodness.
BlazyViewsFieldFile::render in src/Plugin/views/field/BlazyViewsFieldFile.php
Render the field.

File

src/Plugin/Field/FieldFormatter/BlazyVideoTrait.php, line 28

Class

BlazyVideoTrait
A Trait common for Media integration with field details.

Namespace

Drupal\blazy\Plugin\Field\FieldFormatter

Code

public function getImageItem($file) {
  if ($item = BlazyMedia::imageItem($file)) {
    $settings = (array) $item;
    $settings['type'] = 'image';
    $data['item'] = $item;
    $data['settings'] = $settings;
    return $data;
  }
  return [];
}