1 config.inc | config_clear($config_file, $option) |
A shortcut function to delete a single value from a config file.
Note that this function immediately writes the config file to disk and clears associated caches related to the new config. If deleting a number of options in the same configuration file, it is better to create a config object directly, delete all the necessary values, and then save the config file minus new options all at once.
@since 1.7.0
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 delete. The config option may contain periods to indicate levels within the config file.
See also
File
- core/
includes/ config.inc, line 72 - This is the API for configuration storage.
Code
function config_clear($config_file, $option) {
$config = config($config_file);
$config->clear($option);
$config->save();
}