class ThemeRegistryAlter in Image Lazyloader 8
Class ThemeRegistryAlter.
Hierarchy
- class \Drupal\lazyloader\Hooks\ThemeRegistryAlter
Expanded class hierarchy of ThemeRegistryAlter
1 file declares its use of ThemeRegistryAlter
- lazyloader.module in ./
lazyloader.module - Lazyloader Module.
File
- src/
Hooks/ ThemeRegistryAlter.php, line 11
Namespace
Drupal\lazyloader\HooksView source
class ThemeRegistryAlter {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
private $config;
/**
* Creates a new ThemeRegistryAlter instance.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
* The config factory.
*/
public function __construct(ModuleHandlerInterface $moduleHandler, ConfigFactoryInterface $config) {
$this->moduleHandler = $moduleHandler;
$this->config = $config;
}
/**
* Alters the theme registry.
*
* @param array $theme_registry
* The theme registry.
*/
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';
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ThemeRegistryAlter:: |
private | property | The config factory. | |
ThemeRegistryAlter:: |
protected | property | The module handler. | |
ThemeRegistryAlter:: |
public | function | Alters the theme registry. | |
ThemeRegistryAlter:: |
public | function | Creates a new ThemeRegistryAlter instance. |