function ConfigFactory::onConfigDelete

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigFactory.php \Drupal\Core\Config\ConfigFactory::onConfigDelete()
  2. 8.9.x core/lib/Drupal/Core/Config/ConfigFactory.php \Drupal\Core\Config\ConfigFactory::onConfigDelete()
  3. 10 core/lib/Drupal/Core/Config/ConfigFactory.php \Drupal\Core\Config\ConfigFactory::onConfigDelete()

Removes stale static cache entries when configuration is deleted.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.

File

core/lib/Drupal/Core/Config/ConfigFactory.php, line 367

Class

ConfigFactory
Defines the configuration object factory.

Namespace

Drupal\Core\Config

Code

public function onConfigDelete(ConfigCrudEvent $event) {
    $deleted_config = $event->getConfig();
    // We are only concerned with config objects that belong to the collection
    // that matches the storage we depend on. Skip if the event was fired for a
    // config object belonging to a different collection.
    if ($deleted_config->getStorage()
        ->getCollectionName() !== $this->storage
        ->getCollectionName()) {
        return;
    }
    // Ensure that the static cache does not contain deleted configuration.
    foreach ($this->getConfigCacheKeys($deleted_config->getName()) as $cache_key) {
        unset($this->cache[$cache_key]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.