You are here

public function BlazyStylePluginTrait::isImageRenderable in Blazy 8.2

Same name and namespace in other branches
  1. 8 src/Dejavu/BlazyStylePluginTrait.php \Drupal\blazy\Dejavu\BlazyStylePluginTrait::isImageRenderable()
  2. 7 src/Dejavu/BlazyStylePluginTrait.php \Drupal\blazy\Dejavu\BlazyStylePluginTrait::isImageRenderable()

Checks if we can work with this formatter, otherwise no go if flattened.

1 call to BlazyStylePluginTrait::isImageRenderable()
BlazyStylePluginTrait::getImageRenderable in src/Dejavu/BlazyStylePluginTrait.php
Returns the modified renderable image_formatter to support lazyload.

File

src/Dejavu/BlazyStylePluginTrait.php, line 74

Class

BlazyStylePluginTrait
A Trait common for optional views style plugins.

Namespace

Drupal\blazy\Dejavu

Code

public function isImageRenderable($row, $index, $field_image = '') {
  if (!empty($field_image) && ($image = $this
    ->getFieldRenderable($row, $index, $field_image))) {
    if ($this
      ->getImageItem($image)) {
      return $image;
    }

    // Dump Video embed thumbnail/video/colorbox as is.
    if (isset($image['rendered'])) {
      return $image;
    }
  }
  return [];
}