You are here

function relation_type_delete in Relation 7

Deletes a relation type (bundle).

Parameters

$relation_type: The machine name of the relation type (bundle) to be deleted.

2 calls to relation_type_delete()
RelationUITestCase::testRelationImport in tests/relation_ui.test
Tests importing method.
relation_ui_type_delete_confirm_submit in ./relation_ui.module
Process relation type delete confirm submissions.

File

./relation.module, line 427
Describes relations between entities.

Code

function relation_type_delete($relation_type) {
  db_delete('relation_type')
    ->condition('relation_type', $relation_type)
    ->execute();
  db_delete('relation_bundles')
    ->condition('relation_type', $relation_type)
    ->execute();
  if (field_info_instance('relation', 'endpoints', $relation_type)) {
    $instance = array(
      'field_name' => 'endpoints',
      'entity_type' => 'relation',
      'bundle' => $relation_type,
    );
    field_delete_instance($instance, FALSE);
  }
}