You are here

function taxonomy_term_depth_uninstall in Taxonomy Term Depth 8

Same name and namespace in other branches
  1. 7 taxonomy_term_depth.install \taxonomy_term_depth_uninstall()

Implements hook_uninstall()

1 call to taxonomy_term_depth_uninstall()
taxonomy_term_depth_update_8005 in ./taxonomy_term_depth.install
Update entity schema.

File

./taxonomy_term_depth.install, line 54
Install file.

Code

function taxonomy_term_depth_uninstall() {

  // @todo: Replace with DefinitionUpdate handlers as explained on https://www.drupal.org/node/2078241
  $schema = Database::getConnection()
    ->schema();
  if ($schema
    ->tableExists('taxonomy_term_field_data')) {
    $schema
      ->dropField('taxonomy_term_field_data', 'depth');
  }
  $entity_manager = \Drupal::entityManager();
  $definition = $entity_manager
    ->getLastInstalledFieldStorageDefinitions('taxonomy_term')['depth_level'];
  if ($definition) {
    $entity_manager
      ->onFieldStorageDefinitionDelete($definition);
  }
}