You are here

public function BlazyManagerBase::getLightboxes in Blazy 8

Same name and namespace in other branches
  1. 8.2 src/BlazyManagerBase.php \Drupal\blazy\BlazyManagerBase::getLightboxes()
  2. 7 src/BlazyManagerBase.php \Drupal\blazy\BlazyManagerBase::getLightboxes()

Gets the supported lightboxes.

Return value

array The supported lightboxes.

2 calls to BlazyManagerBase::getLightboxes()
BlazyFormatterManager::buildSettings in src/BlazyFormatterManager.php
Returns the field formatter settings inherited by child elements.
BlazyManagerBase::attach in src/BlazyManagerBase.php
Returns array of needed assets suitable for #attached property.

File

src/BlazyManagerBase.php, line 227

Class

BlazyManagerBase
Implements BlazyManagerInterface.

Namespace

Drupal\blazy

Code

public function getLightboxes() {
  $lightboxes = [];
  foreach ([
    'colorbox',
    'photobox',
  ] as $lightbox) {
    if (function_exists($lightbox . '_theme')) {
      $lightboxes[] = $lightbox;
    }
  }

  // Checks only needed for tests.
  if (\Drupal::hasService('app.root') && is_file(\Drupal::root() . '/libraries/photobox/photobox/jquery.photobox.js')) {
    $lightboxes[] = 'photobox';
  }
  $this->moduleHandler
    ->alter('blazy_lightboxes', $lightboxes);
  return array_unique($lightboxes);
}