You are here

public function ContentTypeGroup::delete in Content type groups 7

Same name and namespace in other branches
  1. 7.2 content_type_groups.class.inc \ContentTypeGroup::delete()

Deletes the current content type group.

Return value

ContentTypeGroup Empty ContentTypeGroup object (for chaining)

File

./content_type_groups.module, line 241
Module file for the Content type groups module.

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;
}