You are here

public function BlazyManagerInterface::isBlazy in Blazy 8.2

Same name and namespace in other branches
  1. 7 src/BlazyManagerInterface.php \Drupal\blazy\BlazyManagerInterface::isBlazy()

Checks for Blazy formatter such as from within a Views style plugin.

Ensures the settings traverse up to the container where Blazy is clueless. The supported plugins can add [data-blazy] attribute into its container containing $settings['blazy_data'] converted into [data-blazy] JSON. This allows Blazy Grid, or other Views styles, lacking of UI, to have additional settings extracted from the first Blazy formatter found. Such as media switch/ lightbox. This way the container can add relevant attributes to its container, etc. Also applies to entity references where Blazy is not the main formatter, instead embedded as part of the parent's.

This fairly complex logic is intended to reduce similarly complex logic at individual item. But rather than at individual item, it is executed once at the container level. If you have 100 images, this method is executed once, not 100x, as long as you have all image styles cropped, not scaled.

This still needs improvements and a little more simplified version.

Parameters

array $settings: The settings being modified.

array $item: The first item containing settings or item keys.

See also

\Drupal\blazy\BlazyManager::prepareBuild()

\Drupal\blazy\Dejavu\BlazyEntityBase::buildElements()

1 method overrides BlazyManagerInterface::isBlazy()
BlazyManagerBase::isBlazy in src/BlazyManagerBase.php
Checks for Blazy formatter such as from within a Views style plugin.

File

src/BlazyManagerInterface.php, line 75

Class

BlazyManagerInterface
Defines re-usable services and functions for blazy plugins.

Namespace

Drupal\blazy

Code

public function isBlazy(array &$settings, array $item = []);