1.20.x config.api.php hook_config_create(Config $staging_config)

Respond to or modify configuration creation.

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.

Related topics

File

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

Code

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