You are here

protected function ConfigDevelAutoExportSubscriber::autoExportConfig in Configuration development 8

Automatically export configuration.

Parameters

Config $config: The config object.

2 calls to ConfigDevelAutoExportSubscriber::autoExportConfig()
ConfigDevelAutoExportSubscriber::onConfigRename in src/EventSubscriber/ConfigDevelAutoExportSubscriber.php
React to configuration ConfigEvent::RENAME events.
ConfigDevelAutoExportSubscriber::onConfigSave in src/EventSubscriber/ConfigDevelAutoExportSubscriber.php
React to configuration ConfigEvent::SAVE events.

File

src/EventSubscriber/ConfigDevelAutoExportSubscriber.php, line 82

Class

ConfigDevelAutoExportSubscriber
ConfigDevelAutoExportSubscriber subscriber for configuration CRUD events.

Namespace

Drupal\config_devel\EventSubscriber

Code

protected function autoExportConfig(Config $config) {
  $config_name = $config
    ->getName();
  $file_names = array_filter($this
    ->getSettings()
    ->get('auto_export') ?: [], function ($file_name) use ($config_name) {
    return basename($file_name, '.' . FileStorage::getFileExtension()) == $config_name;
  });
  $this
    ->writeBackConfig($config, $file_names);
}