You are here

public function Registry::get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Theme/Registry.php \Drupal\Core\Theme\Registry::get()

Returns the complete theme registry from cache or rebuilds it.

Return value

array The complete theme registry data array.

See also

Registry::$registry

File

core/lib/Drupal/Core/Theme/Registry.php, line 210
Contains \Drupal\Core\Theme\Registry.

Class

Registry
Defines the theme registry service.

Namespace

Drupal\Core\Theme

Code

public function get() {
  $this
    ->init($this->themeName);
  if (isset($this->registry)) {
    return $this->registry;
  }
  if ($cache = $this->cache
    ->get('theme_registry:' . $this->theme
    ->getName())) {
    $this->registry = $cache->data;
  }
  else {
    $this->registry = $this
      ->build();

    // Only persist it if all modules are loaded to ensure it is complete.
    if ($this->moduleHandler
      ->isLoaded()) {
      $this
        ->setCache();
    }
  }
  return $this->registry;
}