You are here

function eck_example_uninstall in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 examples/eck_example.install \eck_example_uninstall()

Implements hook_uninstall().

File

examples/eck_example.install, line 52
Install and configure and entity type. Then uninstal it.

Code

function eck_example_uninstall() {

  // Deleting and entity type, and all of its content is as easy as creating
  // one. All we have to do is load the entity types that we want to delete, and
  // called the delete method.
  $entity_type = EntityType::loadByName('eck_employee');

  // Even though our entity type was created from code, it is possible that it
  // was deleted from the interface, so we check to make sure we still have
  // and entity type.
  if ($entity_type) {
    $entity_type
      ->delete();
  }

  // After the module is uninstalled, the entity type is gone.
}