function ctools_export_crud_delete
Delete a single exportable object.
This only deletes from the database, which means that if an item is in code, then this is actually a revert.
Parameters
$table: The name of the table to use to retrieve $schema values. This table must have an 'export' section containing data or this function will fail.
$object: The fully populated object to delete, or the export key.
Related topics
5 calls to ctools_export_crud_delete()
- CtoolsExportCrudTestCase::testCrudExportDelete in tests/
ctools_export_test/ ctools_export.test - Tests CRUD operation: Delete.
- CtoolsExportCrudTestCase::testCrudExportRevert in tests/
ctools_export_test/ ctools_export.test - Tests CRUD operation: Revert.
- ctools_export_ui::delete_form_submit in plugins/
export_ui/ ctools_export_ui.class.php - Deletes exportable items from the database.
- ctools_export_ui::edit_wizard_finish in plugins/
export_ui/ ctools_export_ui.class.php - Wizard 'cancel' callback when using a wizard to edit an item.
- _ctools_drush_export_delete in drush/
ctools.drush.inc - Revert a single object.
File
-
includes/
export.inc, line 208
Code
function ctools_export_crud_delete($table, $object) {
$schema = ctools_export_get_schema($table);
$export = $schema['export'];
if (!empty($export['delete callback']) && function_exists($export['delete callback'])) {
return $export['delete callback']($object);
}
else {
// If we were sent an object, get the export key from it. Otherwise
// assume we were sent the export key.
$value = is_object($object) ? $object->{$export['key']} : $object;
db_delete($table)->condition($export['key'], $value)
->execute();
}
}