function geolocation_demo_uninstall in Geolocation Field 8.3
Same name and namespace in other branches
- 8 modules/geolocation_demo/geolocation_demo.install \geolocation_demo_uninstall()
- 8.2 modules/geolocation_demo/geolocation_demo.install \geolocation_demo_uninstall()
Implements hook_uninstall().
File
- modules/
geolocation_demo/ geolocation_demo.install, line 143 - Geolocation demo setup.
Code
function geolocation_demo_uninstall() {
$taxonomy_storage = \Drupal::entityTypeManager()
->getStorage('taxonomy_term');
$node_storage = \Drupal::entityTypeManager()
->getStorage('node');
$taxonomy_storage
->delete($taxonomy_storage
->loadByProperties([
'vid' => 'geolocation_demo_taxonomy',
]));
$node_storage
->delete($node_storage
->loadByProperties([
'type' => 'geolocation_default_article',
]));
foreach ([
'field_geolocation_demo_single',
'field_geolocation_demo_multiple',
'field_geolocation_demo_taxonomy',
] as $field_storage_name) {
$field_storage = FieldStorageConfig::loadByName('node', $field_storage_name);
if ($field_storage) {
$field_storage
->delete();
}
}
field_purge_batch(100);
}