You are here

function template_preprocess_imagelightbox_formatter in ImageLightbox 8

Same name and namespace in other branches
  1. 2.x imagelightbox.module \template_preprocess_imagelightbox_formatter()
  2. 2.0.x imagelightbox.module \template_preprocess_imagelightbox_formatter()

Prepares variables for imagelightbox formatter templates.

Default template: imagelightbox-formatter.html.twig.

Parameters

array $variables: An associative array containing:

  • item: An ImageItem object.
  • item_attributes: An optional associative array of html attributes to be placed in the img tag.
  • image_style: An optional image style.
  • url: An optional \Drupal\Core\Url object.

File

./imagelightbox.module, line 41
Primary module hooks for ImageLightBox module.

Code

function template_preprocess_imagelightbox_formatter(&$variables) {
  module_load_include('inc', 'image', 'image.field');
  template_preprocess_image_formatter($variables);
  $variables['link_attributes'] = new Attribute($variables['link_attributes']);
  $variables['#attached']['library'][] = 'imagelightbox/formatter';
}