You are here

class BlazyFormatterTest in Blazy 8

Same name in this branch
  1. 8 tests/src/Kernel/BlazyFormatterTest.php \Drupal\Tests\blazy\Kernel\BlazyFormatterTest
  2. 8 tests/modules/blazy_test/src/BlazyFormatterTest.php \Drupal\blazy_test\BlazyFormatterTest
Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/src/BlazyFormatterTest.php \Drupal\blazy_test\BlazyFormatterTest

Implements GridStackFormatterInterface.

Hierarchy

Expanded class hierarchy of BlazyFormatterTest

1 string reference to 'BlazyFormatterTest'
blazy_test.services.yml in tests/modules/blazy_test/blazy_test.services.yml
tests/modules/blazy_test/blazy_test.services.yml
1 service uses BlazyFormatterTest
blazy_test.formatter in tests/modules/blazy_test/blazy_test.services.yml
Drupal\blazy_test\BlazyFormatterTest

File

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

Namespace

Drupal\blazy_test
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyFormatterManager::$firstItem protected property The first image item found.
BlazyFormatterManager::buildSettings public function Returns the field formatter settings inherited by child elements.
BlazyFormatterManager::postBuildElements public function Backported few cross-module methods to minimize mismatched branch issues.
BlazyFormatterManager::preBuildElements public function Backported few cross-module methods to minimize mismatched branch issues.
BlazyFormatterTest::getThumbnail public function Gets the thumbnail image using theme_image_style().
BlazyManager::buildDataBlazy public function Builds breakpoints suitable for top-level [data-blazy] wrapper attributes.
BlazyManager::cleanUpBreakpoints public function Cleans up empty breakpoints.
BlazyManager::getBlazy public function Returns the enforced content, or image using theme_blazy().
BlazyManager::getEntityView public function Returns the entity view, if available.
BlazyManager::getImage public function Backported few cross-module methods to minimize mismatched branch issues.
BlazyManager::getResponsiveImageCacheTags public function Returns the Responsive image cache tags.
BlazyManager::isBlazy public function Checks for Blazy formatter such as from within a Views style plugin.
BlazyManager::isCrop public function Checks if an image style contains crop effect.
BlazyManager::preRenderImage public function Builds the Blazy image as a structured array ready for ::renderer().
BlazyManager::setDimensionsOnce public function Sets dimensions once to reduce method calls, if image style contains crop.
BlazyManagerBase::$cache protected property The cache backend.
BlazyManagerBase::$configFactory protected property The config factory.
BlazyManagerBase::$entityTypeManager protected property The entity type manager service.
BlazyManagerBase::$moduleHandler protected property The module handler service.
BlazyManagerBase::$renderer protected property The renderer.
BlazyManagerBase::attach public function Returns array of needed assets suitable for #attached property.
BlazyManagerBase::buildSkins public function Collects defined skins as registered via hook_MODULE_NAME_skins_info().
BlazyManagerBase::configLoad public function Returns any config, or keyed by the $setting_name.
BlazyManagerBase::create public static function
BlazyManagerBase::entityLoad public function Returns a shortcut for loading a config entity: image_style, slick, etc.
BlazyManagerBase::entityLoadMultiple public function Returns a shortcut for loading multiple configuration entities.
BlazyManagerBase::getCache public function Returns the cache.
BlazyManagerBase::getCacheMetadata public function Return the cache metadata common for all blazy-related modules.
BlazyManagerBase::getCommonSettings public function Returns the common settings inherited down to each item.
BlazyManagerBase::getConfigFactory public function Returns the config factory.
BlazyManagerBase::getEntityTypeManager public function Returns the entity type manager.
BlazyManagerBase::getLightboxes public function Gets the supported lightboxes.
BlazyManagerBase::getModuleHandler public function Returns the module handler.
BlazyManagerBase::getRenderer public function Returns the renderer.
BlazyManagerBase::__construct public function Constructs a BlazyManager object.