public static function Vars::staticValue in Variable API 7
Same name and namespace in other branches
- 6.2 vars.module \Vars::staticValue()
- 6 vars.module \Vars::staticValue()
- 7.2 vars.classes.inc \Vars::staticValue()
Central static variable storage.
This static method is provided for compatibility with code using Drupal 6; code for Drupal 7 should use the function provided by Drupal.
Parameters
$name: Globally unique name for the variable. For a function with only one static variable, the function name (e.g. via the PHP magic __FUNCTION__ constant) is recommended. For a function with multiple static variables add a distinguishing suffix to the function name for each one.
$default_value: Optional default value.
$reset: TRUE to reset a specific named variable, or all variables if $name is NULL. Resetting every variable should only be used, for example, for running unit tests with a clean environment. Should be used only though via function vars_static_reset() and the return value should not be used in this case.
Return value
Returns a variable by reference.
1 call to Vars::staticValue()
File
- ./
vars.module, line 367 - Implement an API to handle persistent variables.
Class
- Vars
- @file Implement an API to handle persistent variables.
Code
public static function &staticValue($name, $default_value = NULL, $reset = FALSE) {
return drupal_static($name, $default_value, $reset);
}