function spaces_controller::get in Spaces 7.3
Same name and namespace in other branches
- 6.3 plugins/spaces_controller.inc \spaces_controller::get()
- 7 plugins/spaces_controller.inc \spaces_controller::get()
Get a value for this controller.
Parameters
$id: The id of the value to retrieve. Optional.
$environment: The realm of to fetch the setting for either 'space', 'preset', or 'original'. Optional.
2 calls to spaces_controller::get()
- spaces_controller_variable::init_overrides in plugins/
spaces_controller_variable.inc - Override of init_overrides().
- spaces_controller_variable::load_preset_values in plugins/
spaces_controller_variable.inc - Override of load_preset_values(). We cannot rely on variable_get() -- we must first check our space override values.
File
- plugins/
spaces_controller.inc, line 159
Class
- spaces_controller
- Abstract base class for a spaces controller. Classes that extend spaces_controller must implement load_original_values().
Code
function get($id = NULL, $environment = NULL) {
if (isset($environment, $id)) {
$this
->load_values($environment, $id);
return isset($this->values[$environment][$id]) ? $this->values[$environment][$id] : NULL;
}
else {
if (isset($environment)) {
$this
->load_values($environment);
return isset($this->values[$environment]) ? $this->values[$environment] : NULL;
}
else {
if (isset($id)) {
$environments = array(
'space',
'preset',
'original',
);
$environment = array_shift($environments);
while (isset($this->values[$environment])) {
$this
->load_values($environment, $id);
if (isset($this->values[$environment][$id])) {
return $this->values[$environment][$id];
}
$environment = array_shift($environments);
}
return array();
}
}
}
// Neither argument provided, return merged set of all values.
$this
->load_values();
return array_merge($this->values['original'], $this->values['preset'], $this->values['space']);
}