function ThemeRegistry::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::__construct()
- 8.9.x core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::__construct()
- 10 core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::__construct()
- 11.x core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::__construct()
Overrides DrupalCacheArray::__construct
File
-
includes/
theme.inc, line 381
Class
- ThemeRegistry
- Builds the run-time theme registry.
Code
function __construct($cid, $bin) {
$this->cid = $cid;
$this->bin = $bin;
$this->persistable = module_load_all(NULL) && $_SERVER['REQUEST_METHOD'] == 'GET';
$data = array();
if ($this->persistable && ($cached = cache_get($this->cid, $this->bin))) {
$data = $cached->data;
}
else {
// If there is no runtime cache stored, fetch the full theme registry,
// but then initialize each value to NULL. This allows offsetExists()
// to function correctly on non-registered theme hooks without triggering
// a call to resolveCacheMiss().
$data = $this->initializeRegistry();
if ($this->persistable) {
$this->set($data);
}
}
$this->storage = $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.