You are here

private function ThemePreprocess::determineLibraryToAttach in Image Lazyloader 8

Determines the library to attach.

Return value

string The library to attach.

1 call to ThemePreprocess::determineLibraryToAttach()
ThemePreprocess::attachLibrary in src/ThemePreprocess.php
Attaches the Lazyloader library to a render array.

File

src/ThemePreprocess.php, line 68

Class

ThemePreprocess
Class ThemePreprocess.

Namespace

Drupal\lazyloader

Code

private function determineLibraryToAttach() {
  $config = $this->configFactory
    ->get('lazyloader.configuration');
  if ($config
    ->get('debugging')) {
    $library = 'lazyloader/lazysizes';
    return $library;
  }
  if ($config
    ->get('cdn') || !file_exists('libraries/lazysizes/lazysizes.min.js')) {
    $library = 'lazyloader/lazysizes-min.cdn';
    return $library;
  }
  $library = 'lazyloader/lazysizes-min';
  return $library;
}