Interim commit.
[yaffs-website] / web / modules / contrib / blazy / tests / modules / blazy_test / src / BlazyFormatterTest.php
1 <?php
2
3 namespace Drupal\blazy_test;
4
5 use Drupal\blazy\BlazyFormatterManager;
6
7 /**
8  * Implements GridStackFormatterInterface.
9  */
10 class BlazyFormatterTest extends BlazyFormatterManager implements BlazyFormatterTestInterface {
11
12   /**
13    * Gets the thumbnail image using theme_image_style().
14    *
15    * @param array $settings
16    *   The array containing: thumbnail_style, etc.
17    * @param object $item
18    *   The \Drupal\image\Plugin\Field\FieldType\ImageItem object.
19    *
20    * @return array
21    *   The renderable array of thumbnail image.
22    */
23   public function getThumbnail(array $settings = [], $item = NULL) {
24     $thumbnail = [];
25     if (!empty($settings['uri'])) {
26       $thumbnail = [
27         '#theme'      => 'image_style',
28         '#style_name' => isset($settings['thumbnail_style']) ? $settings['thumbnail_style'] : 'thumbnail',
29         '#uri'        => $settings['uri'],
30         '#item'       => $item,
31       ];
32     }
33     return $thumbnail;
34   }
35
36 }