You are here

public static function BlazyInterface::preprocessBlazy in Blazy 8.2

Prepares variables for blazy.html.twig templates.

Most heavy liftings are performed at BlazyManager::preRender().

Parameters

array $variables: An associative array containing:

  • captions: An optional renderable array of inline or lightbox captions.
  • item: The image item containing alt, title, etc.
  • image: An optional renderable array of (Responsive) image element. Image is optional for CSS background, or iframe only displays.
  • settings: HTML related settings containing at least a required uri.
  • url: An optional URL the image can be linked to, can be any of audio/video, or entity URLs, when using Colorbox/Photobox, or Link to content options.
  • attributes: The container attributes (media, media--ratio etc.).
  • item_attributes: The image attributes (width, height, src, etc.).
  • url_attributes: An array of URL attributes, lightbox or content links.
  • noscript: The fallback image for non-js users.
  • postscript: Any extra content to put into blazy goes here. Use keyed or indexed array to not conflict with or nullify other providers, e.g.: postscript.cta, or postscript.widget. Avoid postscript = cta.
  • content: Various Media entities like Facebook, Instagram, local Video, etc. Basically content is the replacement for (Responsive) image and oEmbed video. This makes it possible to have a mix of Media entities, image and videos on a Blazy Grid, Slick, GridStack, etc. Regular Blazy features are still disabled by default at \Drupal\blazy\BlazyDefault::richSettings() to avoid complication. However you can override them accordingly as needed, such as lightbox for local Video with/o a pre-configured poster image. The #settings are provided under content variables for more work. Originally content is a theme_field() output, trimmed down to bare minimum.
1 method overrides BlazyInterface::preprocessBlazy()
Blazy::preprocessBlazy in src/Blazy.php
Prepares variables for blazy.html.twig templates.

File

src/BlazyInterface.php, line 48

Class

BlazyInterface
Provides common blazy utility static methods.

Namespace

Drupal\blazy

Code

public static function preprocessBlazy(array &$variables);