function tweet_feed_uninstall in Tweet Feed 8.3
Same name and namespace in other branches
- 6 tweet_feed.install \tweet_feed_uninstall()
- 7.3 tweet_feed.install \tweet_feed_uninstall()
- 7 tweet_feed.install \tweet_feed_uninstall()
- 7.2 tweet_feed.install \tweet_feed_uninstall()
- 4.x tweet_feed.install \tweet_feed_uninstall()
implements hook_uninstall().
File
- ./
tweet_feed.install, line 9
Code
function tweet_feed_uninstall() {
// Remove all of our custom taxonomies. We need to delete the terms first,
// then we can remove the taxonomies themselves.
// Look up the vocabulary ID's for our various vocabuilaries
$vocabulary_ids = [
'twitter_user_mention_terms',
'twitter_hashtag_terms',
'twitter_followers',
'twitter_former_followers',
];
foreach ($vocabulary_ids as $vocabulary_id) {
// Remove all of the terms from this vocabulary.
$vids = Vocabulary::loadMultiple();
foreach ($vids as $vid) {
if ($vid
->id() == $vocabulary_id) {
$terms = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadTree($vid
->id());
if (!empty($terms)) {
foreach ($terms as $term) {
$term = \Drupal\taxonomy\Entity\Term::load($term->tid);
$term
->delete();
}
}
// Then remove the vocabulary.
$vocabulary = Vocabulary::load($vid
->id());
$vocabulary
->delete();
}
}
}
}