Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / blazy / tests / modules / blazy_test / src / BlazyFormatterTest.php
diff --git a/web/modules/contrib/blazy/tests/modules/blazy_test/src/BlazyFormatterTest.php b/web/modules/contrib/blazy/tests/modules/blazy_test/src/BlazyFormatterTest.php
new file mode 100644 (file)
index 0000000..d88559b
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace Drupal\blazy_test;
+
+use Drupal\blazy\BlazyFormatterManager;
+
+/**
+ * Implements GridStackFormatterInterface.
+ */
+class BlazyFormatterTest extends BlazyFormatterManager implements BlazyFormatterTestInterface {
+
+  /**
+   * Gets the thumbnail image using theme_image_style().
+   *
+   * @param array $settings
+   *   The array containing: thumbnail_style, etc.
+   * @param object $item
+   *   The \Drupal\image\Plugin\Field\FieldType\ImageItem object.
+   *
+   * @return array
+   *   The renderable array of thumbnail image.
+   */
+  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;
+  }
+
+}