You are here

function _lazyloader_alter in Image Lazyloader 8

Allow modules to modify assets prior to modification or skip it altogether.

Parameters

array $vars: The preprocess_[responsive_]image() arguments.

Return value

bool Should lazyloader ignore this asset ?

2 calls to _lazyloader_alter()
lazyloader_preprocess_image in ./lazyloader.module
Implements hook_preprocess_image().
lazyloader_preprocess_responsive_image in ./lazyloader.module
Implements hook_preprocess_responsive_image().

File

./lazyloader.module, line 23
Lazyloader Module.

Code

function _lazyloader_alter(array &$vars) {

  // Allow alter for modules.
  \Drupal::moduleHandler()
    ->alter('lazyloader', $vars);
  if (!empty($vars['lazyloader_ignore'])) {
    return TRUE;
  }

  // Allow alter for themes.
  \Drupal::theme()
    ->alter('lazyloader', $vars);
  if (!empty($vars['lazyloader_ignore'])) {
    return TRUE;
  }
  unset($vars['lazyloader_ignore']);
  return FALSE;
}