function spaces_controller::del in Spaces 7
Same name and namespace in other branches
- 6.3 plugins/spaces_controller.inc \spaces_controller::del()
- 7.3 plugins/spaces_controller.inc \spaces_controller::del()
Delete a controller object override for this space.
File
- plugins/
spaces_controller.inc, line 220
Class
- spaces_controller
- Abstract base class for a spaces controller. Classes that extend spaces_controller must implement load_original_values().
Code
function del($id = NULL) {
$query = "{spaces_overrides} WHERE type = :type AND id = :id AND object_type = :object_type";
$override = array(
':type' => $this->space_type,
':id' => $this->space_id,
':object_type' => $this->controller,
);
if (isset($id)) {
$query .= " AND object_id = :object_id";
$override[':object_id'] = $id;
}
$exists = db_query("SELECT id FROM {$query}", $override)
->fetchField();
if ($exists) {
db_query("DELETE FROM {$query}", $override);
if (isset($this->values['space'][$id])) {
unset($this->values['space'][$id]);
}
return TRUE;
}
return FALSE;
}