1.20.x bootstrap.inc | state_set($name, $value) |
Sets a persistent state value.
Parameters
$name: The name of the state to set.
$value: The value to set. Complex data types will be serialized upon storage.
See also
File
- includes/
bootstrap.inc, line 1341 - Functions that need to be loaded on every Backdrop request.
Code
function state_set($name, $value) {
$states = &backdrop_static('states');
db_merge('state')
->key(array('name' => $name))
->fields(array('value' => serialize($value)))
->execute();
cache('cache')->delete('states');
if (isset($states)) {
$states[$name] = $value;
}
}