class BlazyTestAlter in Blazy 8.2
Provides a render callback to sets blazy_test related URL attributes.
Hierarchy
- class \Drupal\blazy_test\BlazyTestAlter implements RenderCallbackInterface
Expanded class hierarchy of BlazyTestAlter
See also
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_testView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlazyTestAlter:: |
public static | function | The #pre_render callback: Sets lightbox image URL. |