ConfigFactory::onConfigSave

public ConfigFactory::onConfigSave(ConfigCrudEvent $event)

Updates stale static cache entries when configuration is saved.

Parameters

ConfigCrudEvent $event: The configuration event.

File

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

Class

ConfigFactory
Defines the configuration object factory.

Namespace

Drupal\Core\Config

Code

public function onConfigSave(ConfigCrudEvent $event) {
  // Ensure that the static cache contains up to date configuration objects by
  // replacing the data on any entries for the configuration object apart
  // from the one that references the actual config object being saved.
  $saved_config = $event->getConfig();
  foreach ($this->getConfigCacheKeys($saved_config->getName()) as $cache_key) {
    $cached_config = $this->cache[$cache_key];
    if ($cached_config !== $saved_config) {
      // We can not just update the data since other things about the object
      // might have changed. For example, whether or not it is new.
      $this->cache[$cache_key]->initWithData($saved_config->getRawData());
    }
  }
}
doc_Drupal
2016-10-29 08:53:15
Comments
Leave a Comment

Please login to continue.