function spaces_controller::set in Spaces 6.3
Same name and namespace in other branches
- 7.3 plugins/spaces_controller.inc \spaces_controller::set()
- 7 plugins/spaces_controller.inc \spaces_controller::set()
Set override values for a given controller object in this space.
File
- plugins/
spaces_controller.inc, line 179
Class
- spaces_controller
- Abstract base class for a spaces controller. Classes that extend spaces_controller must implement load_original_values().
Code
function set($id, $value) {
$override = array(
'type' => $this->space_type,
'id' => $this->space_id,
'object_type' => $this->controller,
'object_id' => $id,
);
$exists = db_result(db_query("SELECT id FROM {spaces_overrides} WHERE type = '%s' AND id = '%s' AND object_type = '%s' AND object_id = '%s'", $override));
$keys = array_keys($override);
$override['value'] = $value;
if ($exists) {
drupal_write_record('spaces_overrides', $override, $keys);
}
else {
drupal_write_record('spaces_overrides', $override);
}
$this->values['space'][$id] = $value;
// @todo Throw an exception if set failed.
return TRUE;
}