bcubed-8.x-1.0-beta5/bcubed.install
bcubed.install
<?php
/**
* @file
* Install, update and uninstall functions for the Bcubed module.
*/
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
/**
* Implements hook_uninstall().
*/
function bcubed_uninstall() {
// Remove the field storage and instance configuration.
$content_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
foreach ($content_types as $type => $value) {
if (FieldConfig::loadByName('node', $type, 'bcubed')) {
FieldConfig::loadByName('node', $type, 'bcubed')->delete();
}
}
// After all field instances have been deleted, delete the field storage.
if (FieldStorageConfig::loadByName('node', 'bcubed')) {
FieldStorageConfig::loadByName('node', 'bcubed')->delete();
}
}
