1 config.inc config_set($config_file, $option, $value)

A shortcut function to set and save a single value in a config file.

Note that this function immediately writes the config file to disk and clears associated caches related to the new config. If writing a number of options to the same configuration file, it is better to create a config object directly, set all the new values, and then save the config file with all the new options all at once.

Parameters

string $config_file: The name of the configuration object to retrieve. The name corresponds to an JSON configuration file. For

config(book.admin) 

, the config object returned will contain the contents of book.admin.json.

string $option: The name of the config option within the file to set. The config option may contain periods to indicate levels within the config file.

mixed $value: The value to save into the config file.

File

core/includes/config.inc, line 149
This is the API for configuration storage.

Code

function config_set($config_file, $option, $value) {
  $config = config($config_file);
  $config->set($option, $value);
  $config->save();
}