You are here

public function BlazyFormatterTest::getThumbnail in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/src/BlazyFormatterTest.php \Drupal\blazy_test\BlazyFormatterTest::getThumbnail()

Gets the thumbnail image using theme_image_style().

Parameters

array $settings: The array containing: thumbnail_style, etc.

object $item: The \Drupal\image\Plugin\Field\FieldType\ImageItem object.

Return value

array The renderable array of thumbnail image.

File

tests/modules/blazy_test/src/BlazyFormatterTest.php, line 23

Class

BlazyFormatterTest
Implements GridStackFormatterInterface.

Namespace

Drupal\blazy_test

Code

public function getThumbnail(array $settings = [], $item = NULL) {
  $thumbnail = [];
  if (!empty($settings['uri'])) {
    $thumbnail = [
      '#theme' => 'image_style',
      '#style_name' => isset($settings['thumbnail_style']) ? $settings['thumbnail_style'] : 'thumbnail',
      '#uri' => $settings['uri'],
      '#item' => $item,
    ];
  }
  return $thumbnail;
}