You are here

public function ConfigDevelAutoImportSubscriber::autoImportConfig in Configuration development 8

Reinstall changed config files.

File

src/EventSubscriber/ConfigDevelAutoImportSubscriber.php, line 15

Class

ConfigDevelAutoImportSubscriber

Namespace

Drupal\config_devel\EventSubscriber

Code

public function autoImportConfig() {
  $config = $this
    ->getSettings();
  $changed = FALSE;
  foreach ($config
    ->get('auto_import') as $key => $file) {
    if ($new_hash = $this
      ->importOne($file['filename'], $file['hash'])) {
      $config
        ->set("auto_import.{$key}.hash", $new_hash);
      $changed = TRUE;
    }
  }
  if ($changed) {
    $config
      ->save();
  }
}