You are here

public function DefaultPluginManager::clearCachedDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::clearCachedDefinitions()

Clears static and persistent plugin definition caches.

Don't resort to calling \Drupal::cache()->delete() and friends to make Drupal detect new or updated plugin definitions. Always use this method on the appropriate plugin type's plugin manager!

Overrides CachedDiscoveryInterface::clearCachedDefinitions

4 calls to DefaultPluginManager::clearCachedDefinitions()
BreakpointManager::clearCachedDefinitions in core/modules/breakpoint/src/BreakpointManager.php
Clears static and persistent plugin definition caches.
ElementInfoManager::clearCachedDefinitions in core/lib/Drupal/Core/Render/ElementInfoManager.php
Clears static and persistent plugin definition caches.
EntityTypeManager::clearCachedDefinitions in core/lib/Drupal/Core/Entity/EntityTypeManager.php
Clears static and persistent plugin definition caches.
TypedDataManager::clearCachedDefinitions in core/lib/Drupal/Core/TypedData/TypedDataManager.php
Clears static and persistent plugin definition caches.
4 methods override DefaultPluginManager::clearCachedDefinitions()
BreakpointManager::clearCachedDefinitions in core/modules/breakpoint/src/BreakpointManager.php
Clears static and persistent plugin definition caches.
ElementInfoManager::clearCachedDefinitions in core/lib/Drupal/Core/Render/ElementInfoManager.php
Clears static and persistent plugin definition caches.
EntityTypeManager::clearCachedDefinitions in core/lib/Drupal/Core/Entity/EntityTypeManager.php
Clears static and persistent plugin definition caches.
TypedDataManager::clearCachedDefinitions in core/lib/Drupal/Core/TypedData/TypedDataManager.php
Clears static and persistent plugin definition caches.

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 177
Contains \Drupal\Core\Plugin\DefaultPluginManager.

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

public function clearCachedDefinitions() {
  if ($this->cacheBackend) {
    if ($this->cacheTags) {

      // Use the cache tags to clear the cache.
      Cache::invalidateTags($this->cacheTags);
    }
    else {
      $this->cacheBackend
        ->delete($this->cacheKey);
    }
  }
  $this->definitions = NULL;
}