You are here

class BlazyTestAlter in Blazy 8.2

Provides a render callback to sets blazy_test related URL attributes.

Hierarchy

Expanded class hierarchy of BlazyTestAlter

See also

blazy_test_blazy_alter()

blazy_photoswipe_blazy_alter()

1 file declares its use of BlazyTestAlter
blazy_test.module in tests/modules/blazy_test/blazy_test.module
Testing various Blazy hooks, etc.

File

tests/modules/blazy_test/src/BlazyTestAlter.php, line 13

Namespace

Drupal\blazy_test
View source
class BlazyTestAlter implements RenderCallbackInterface {

  /**
   * The #pre_render callback: Sets lightbox image URL.
   */
  public static function preRender($image) {
    $settings = isset($image['#settings']) ? $image['#settings'] : [];

    // Video's HREF points to external site, adds URL to local image.
    if (!empty($settings['box_url']) && !empty($settings['embed_url'])) {
      $image['#url_attributes']['data-box-url'] = $settings['box_url'];
    }
    return $image;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyTestAlter::preRender public static function The #pre_render callback: Sets lightbox image URL.