function ThemeRegistry::__construct

Constructs a ThemeRegistry object.

Parameters

string $cid: The cid for the array being cached.

string $bin: The bin to cache the array.

array $tags: (optional) The tags to specify for the cache item.

Overrides CacheArray::__construct

File

drupal/core/lib/Drupal/Core/Utility/ThemeRegistry.php, line 46
Definition of Drupal\Core\Utility\ThemeRegistry

Class

ThemeRegistry
Builds the run-time theme registry.

Namespace

Drupal\Core\Utility

Code

function __construct($cid, $bin, $tags) {
  $this->cid = $cid;
  $this->bin = $bin;
  $this->tags = $tags;
  $this->persistable = module_load_all(NULL) && $_SERVER['REQUEST_METHOD'] == 'GET';
  $data = array();
  if ($this->persistable && ($cached = cache($this->bin)
    ->get($this->cid))) {
    $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;
}