You are here

function xmlsitemap_uninstall in XML sitemap 8

Same name and namespace in other branches
  1. 5.2 xmlsitemap/xmlsitemap.install \xmlsitemap_uninstall()
  2. 5 xmlsitemap.install \xmlsitemap_uninstall()
  3. 6.2 xmlsitemap.install \xmlsitemap_uninstall()
  4. 6 xmlsitemap.install \xmlsitemap_uninstall()
  5. 7.2 xmlsitemap.install \xmlsitemap_uninstall()
  6. 2.x xmlsitemap.install \xmlsitemap_uninstall()

Implements hook_uninstall().

File

./xmlsitemap.install, line 336
Install, update and uninstall functions for the xmlsitemap module.

Code

function xmlsitemap_uninstall() {
  $variables = array_keys(xmlsitemap_state_variables());
  foreach ($variables as $variable) {
    \Drupal::state()
      ->delete($variable);
  }

  // Remove the file cache directory.
  xmlsitemap_clear_directory(NULL, TRUE);
  $entity_types = \Drupal::entityTypeManager()
    ->getDefinitions();
  $bundles = \Drupal::service('entity_type.bundle.info')
    ->getAllBundleInfo();
  foreach ($entity_types as $entity_type_id => $entity_type) {
    if (isset($bundles[$entity_type_id])) {
      foreach ($bundles[$entity_type_id] as $bundle_id => $bundle) {
        xmlsitemap_link_bundle_delete($entity_type_id, $bundle_id);
      }
    }
  }
}