1 config.inc | config_set_multiple($config_file, $options) |
A shortcut function to set and save multiple values in a config file.
Note that this function immediately writes the config file to disk and clears associated caches related to the new config. Unlike config_set() which would need to be called once per value, this function updates all the values and then saves the object.
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.
array $options: A keyed array of configuration option names mapping their values.
File
- core/
includes/ config.inc, line 199 - This is the API for configuration storage.
Code
function config_set_multiple($config_file, $options) {
$config = config($config_file);
$config->setMultiple($options);
$config->save();
}