public function ThemeRegistry::__construct in Express 8
Constructs a \Drupal\Core\Theme\Registry object.
Parameters
string $root: The app root.
\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend interface to use for the complete theme registry data.
\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend.
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler to use to load modules.
\Drupal\Core\Extension\ThemeHandlerInterface $theme_handler: The theme handler.
\Drupal\Core\Theme\ThemeInitializationInterface $theme_initialization: The theme initialization.
string $theme_name: (optional) The name of the theme for which to construct the registry.
\Drupal\Core\Cache\CacheBackendInterface $runtime_cache: The cache backend interface to use for the runtime theme registry data.
Overrides Registry::__construct
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Alter/ ThemeRegistry.php, line 41 - Contains \Drupal\bootstrap\Plugin\Alter\ThemeRegistry.
Class
- ThemeRegistry
- Extends the theme registry to override and use protected functions.
Namespace
Drupal\bootstrap\Plugin\AlterCode
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
// This is technically a plugin constructor, but because we wish to use the
// protected methods of the Registry class, we must extend from it. Thus,
// to properly construct the extended Registry object, we must pass the
// arguments it would normally get from the service container to "fake" it.
if (!isset($configuration['theme'])) {
$configuration['theme'] = Bootstrap::getTheme();
}
$this->currentTheme = $configuration['theme'];
parent::__construct(\Drupal::service('app.root'), \Drupal::service('cache.default'), \Drupal::service('lock'), \Drupal::service('module_handler'), \Drupal::service('theme_handler'), \Drupal::service('theme.initialization'), $this->currentTheme
->getName());
$this
->setThemeManager(\Drupal::service('theme.manager'));
$this
->init();
}