You are here

protected function QueryFactory::updateConfigKeyStore in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php \Drupal\Core\Config\Entity\Query\QueryFactory::updateConfigKeyStore()

Updates or adds lookup data.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type: The entity type.

\Drupal\Core\Config\Config $config: The configuration object that is being saved.

1 call to QueryFactory::updateConfigKeyStore()
QueryFactory::onConfigSave in core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php
Updates configuration entity in the key store.

File

core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php, line 94

Class

QueryFactory
Provides a factory for creating entity query objects for the config backend.

Namespace

Drupal\Core\Config\Entity\Query

Code

protected function updateConfigKeyStore(ConfigEntityTypeInterface $entity_type, Config $config) {
  $config_key_store = $this
    ->getConfigKeyStore($entity_type);
  foreach ($entity_type
    ->getLookupKeys() as $lookup_key) {
    foreach ($this
      ->getKeys($config, $lookup_key, 'get', $entity_type) as $key) {
      $values = $config_key_store
        ->get($key, []);
      if (!in_array($config
        ->getName(), $values, TRUE)) {
        $values[] = $config
          ->getName();
        $config_key_store
          ->set($key, $values);
      }
    }
  }
}