You are here

public function ConfigImportEventSubscriber::onConfigValidate in Config Ignore Keys 8

Reacts to configuration validation.

Fetches the plugins containing the needed configurations to be ignored and saves in state their initial value.

File

src/EventSubscriber/ConfigImportEventSubscriber.php, line 108

Class

ConfigImportEventSubscriber
Class ConfigImportEventSubscriber.

Namespace

Drupal\config_ignore_keys\EventSubscriber

Code

public function onConfigValidate() {
  foreach ($this->plugins as $plugin) {
    foreach ($this->pluginManager
      ->createInstance($plugin['id'])
      ->getConfigurations() as $configFile => $keys) {
      if (is_array($keys)) {
        foreach ($keys as $configKey) {
          $this
            ->saveStateWithConfig($configFile, $configKey);
        }
      }
      else {
        $this
          ->saveStateWithConfig($configFile, $configFile);
      }
    }
  }
}