You are here

function blazy_photoswipe_pre_render in Blazy PhotoSwipe 7

The #pre_render callback: Sets PhotoSwipe related URL attributes.

1 string reference to 'blazy_photoswipe_pre_render'
blazy_photoswipe_blazy_alter in ./blazy_photoswipe.module
Implements hook_blazy_alter().

File

./blazy_photoswipe.module, line 41
Provides a simple Blazy PhotoSwipe integration.

Code

function blazy_photoswipe_pre_render($image) {
  $settings = isset($image['#settings']) ? $image['#settings'] : [];

  // Video's HREF points to external site, adds URL to local image.
  // Cannot rely on IMG as IMG is not there when using CSS background.
  if (!empty($settings['box_url']) && !empty($settings['embed_url'])) {
    $image['#url_attributes']['data-box-url'] = $settings['box_url'];
  }
  return $image;
}