Created
February 3, 2016 05:16
-
-
Save xtfer/322fd19a9f17e1c7abe4 to your computer and use it in GitHub Desktop.
Globals usage information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 \Drupal\ghost\Exception\GhostException | |
*/ | |
function globals_filter($key, $check_function = 'check_plain') { | |
return Globals::init()->getFilteredValue($key, $check_function); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment