ThemeRegistryAlter.php in Image Lazyloader 8
File
src/Hooks/ThemeRegistryAlter.php
View source
<?php
namespace Drupal\lazyloader\Hooks;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
class ThemeRegistryAlter {
protected $moduleHandler;
private $config;
public function __construct(ModuleHandlerInterface $moduleHandler, ConfigFactoryInterface $config) {
$this->moduleHandler = $moduleHandler;
$this->config = $config;
}
public function themeRegistryAlter(array &$theme_registry) {
if ($this->config
->get('lazyloader.configuration')
->get('enabled')) {
$theme_registry['image']['path'] = $this->moduleHandler
->getModule('lazyloader')
->getPath() . '/templates';
$theme_registry['image']['template'] = 'image';
$theme_registry['responsive_image']['preprocess functions'][] = 'lazyloader_preprocess_responsive_image';
}
}
}