1 config.api.php hook_config_update(Config $staging_config, Config $active_config)
1 config_test_hooks.module hook_config_update(Config $staging_config, Config $active_config)

Respond to configuration updates.

Parameters

Config $staging_config: The configuration object for the settings about to be saved. This object is always passed by reference and may be modified to adjust the settings that are saved.

Config $active_config: The configuration object for the settings being replaced.

Related topics

File

core/modules/config/config.api.php, line 185
Documentation for hooks provided by Config module.

Code

function hook_config_update(Config $staging_config, Config $active_config) {
  if (strpos($staging_config->getName(), 'image.style') === 0) {
    // Set a value before the config is saved.
    if (is_null($active_config->get('some_key'))) {
      $staging_config->set('some_key', 'default');
    }
  }
}