public function view::delete in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 includes/view.inc \view::delete()
- 6.2 includes/view.inc \view::delete()
Delete the view from the database.
File
- includes/
view.inc, line 1929 - views_objects Objects that represent a View or part of a view
Class
- view
- An object to contain all of the data to generate a view.
Code
public function delete($clear = TRUE) {
if (empty($this->vid)) {
return;
}
db_delete('views_view')
->condition('vid', $this->vid)
->execute();
// Delete from all of our subtables as well.
foreach ($this
->db_objects() as $key) {
db_delete('views_' . $key)
->condition('vid', $this->vid)
->execute();
}
cache_clear_all('views_query:' . $this->name, 'cache_views');
if ($clear) {
// Clear caches.
cache_clear_all('views_block_items:', 'cache_views', TRUE);
views_invalidate_cache('ctools_export:views_view:' . $this->name);
}
// Notify modules that this view has been deleted.
module_invoke_all('views_view_delete', $this);
}