Globals
Categories
Component ID
2557615
Component name
Globals
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
680
Component created
Component changed
Component body
Globals solves the problem of providing user editable configuration properties by giving developers an API for providing these properties.
Usage
Globals provides a hook for declaring global properties, as well as a functions for getting these values back for later use.
Current hook documentation is available in the globals.api.php file.
There are two primary functions for retrieving these values:
<?php
/**
* Get a global value.
*
* A useful shorthand for accessing the Globals object.
*
* @param string $key
* Key to access
*
* @return mixed
* Result of the global
*/
function globals_get($key) {
return Globals::init()->getGlobalValue($key);
}
/**
* Get a global value filtered.
*
* @param string $key
* Global value key
* @param string $check_function
* Filter name. Defaults to 'check_plain'. If you provide another filter
* value, its up to you to ensure the output is secure.
*
* @return mixed
* Result of the query.
* @throws DrupalghostExceptionGhostException
*/
function globals_filter($key, $check_function = 'check_plain') {
return Globals::init()->getFilteredValue($key, $check_function);
}
?>
