1.20.x config.inc | config_get($config_file, $option = NULL) |
A shortcut function to load and retrieve a single value from a config file.
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 read. The config option may contain periods to indicate levels within the config file. If NULL is passed in, the entire contents of the config file will be returned.
Return value
mixed: The contents of the requested config option. Returns NULL if the specified option was not found in the file at all.
See also
File
- includes/
config.inc, line 117 - This is the API for configuration storage.
Code
function config_get($config_file, $option = NULL) {
$config = config($config_file);
return $config->get($option);
}