Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This project is not covered by Drupal’s security advisory policy.
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 \Drupal\ghost\Exception\GhostException
*/
function globals_filter($key, $check_function = 'check_plain') {
return Globals::init()->getFilteredValue($key, $check_function);
}
?>
Supporting organizations:
Current project sponsors
Project information
- Module categories: Content Display, Developer Tools
- 5 sites report using this module
- Created by xtfer on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
7.x-1.0-beta2
released 17 June 2016
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.