You are here

public static function BlazyAlter::attachColorbox in Blazy 8.2

Attaches Colorbox if so configured.

1 call to BlazyAlter::attachColorbox()
BlazyManagerBase::attach in src/BlazyManagerBase.php
Returns array of needed assets suitable for #attached property.

File

src/BlazyAlter.php, line 196

Class

BlazyAlter
Provides hook_alter() methods for Blazy.

Namespace

Drupal\blazy

Code

public static function attachColorbox(array &$load, $attach = []) {
  if (\Drupal::hasService('colorbox.attachment')) {
    $dummy = [];
    \Drupal::service('colorbox.attachment')
      ->attach($dummy);
    $load = isset($dummy['#attached']) ? NestedArray::mergeDeep($load, $dummy['#attached']) : $load;
    $load['library'][] = 'blazy/colorbox';
    unset($dummy);
  }
}