Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Registry.php

function Registry::reset

Invalidates theme registry caches.

To be called when the list of enabled extensions is changed.

File

core/lib/Drupal/Core/Theme/Registry.php, line 828

Class

Registry
Defines the theme registry service.

Namespace

Drupal\Core\Theme

Code

public function reset() {
    // Reset the runtime registry.
    foreach ($this->runtimeRegistry as $runtime_registry) {
        $runtime_registry->clear();
    }
    $this->runtimeRegistry = [];
    $this->registry = [];
    // Installing and uninstalling themes doesn't invalidate caches because
    // rendered output varies by theme, however the tabs on the appearance page
    // depend on the theme list, so invalidate those via the local tasks cache
    // tag.
    Cache::invalidateTags([
        'local_task',
    ]);
    $cids = [
        'theme_registry:build:modules',
    ];
    foreach ($this->themeHandler
        ->listInfo() as $theme_name => $info) {
        $cids[] = 'theme_registry:' . $theme_name;
        $cids[] = 'theme_registry:runtime:' . $theme_name;
    }
    $this->cache
        ->deleteMultiple($cids);
    if ($this->runtimeCache) {
        $this->runtimeCache
            ->deleteMultiple($cids);
    }
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal