You are here

protected function spaces_controller::load_preset_values in Spaces 7

Same name and namespace in other branches
  1. 6.3 plugins/spaces_controller.inc \spaces_controller::load_preset_values()
  2. 7.3 plugins/spaces_controller.inc \spaces_controller::load_preset_values()

Protected method that ensures a preset-level override for the provided object has been loaded. Since presets values are stored in aggregate, the $id argument here is largely for consistency.

1 call to spaces_controller::load_preset_values()
spaces_controller::load_values in plugins/spaces_controller.inc
Wrapper around load_[environment]_values.
1 method overrides spaces_controller::load_preset_values()
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 131

Class

spaces_controller
Abstract base class for a spaces controller. Classes that extend spaces_controller must implement load_original_values().

Code

protected function load_preset_values($id = NULL) {
  if (!$this->loaded_all['preset']) {
    $preset_name = variable_get("spaces_preset_{$this->space_type}", NULL);
    if ($preset_name && ($preset = spaces_preset_load($preset_name))) {
      if (isset($preset->value[$this->controller])) {
        $this->values['preset'] = $preset->value[$this->controller];
      }
    }
    $this->loaded_all['preset'] = TRUE;
  }
}