public function ContentTypeGroup::delete in Content type groups 7.2
Same name and namespace in other branches
- 7 content_type_groups.module \ContentTypeGroup::delete()
Deletes the current content type group.
Return value
ContentTypeGroup Empty ContentTypeGroup object (for chaining)
File
- ./
content_type_groups.class.inc, line 113
Class
- ContentTypeGroup
- Utility class to handle content type groups
Code
public function delete() {
$transaction = db_transaction();
try {
// Delete the content types for this group
db_delete(self::$table_types)
->condition('group_type', $this->type)
->execute();
// Delete the content type group
db_delete(self::$table_groups)
->condition('type', $this->type)
->execute();
} catch (Exception $e) {
$transaction
->rollback();
watchdog_exception('content type groups', $e);
throw $e;
}
// Clear the current content type group
$this->type = NULL;
$this->name = NULL;
$this->content_types = array();
return $this;
}