badgr_badge-8.x-1.x-dev/badgr_badge.install
badgr_badge.install
<?php /** * @file * Install, update and uninstall functions for the module. */ /** * Implements hook_uninstall(). */ function badgr_badge_uninstall() { $result = \Drupal::entityQuery('node') ->condition('type', ['badgr_account','badgr_issuer','badgr_badges'], 'IN') ->execute(); entity_delete_multiple('node', $result); $configFactory = \Drupal::configFactory(); $configNames = [ 'field.field.node.badgr_account.field_badgr_access_token', 'field.field.node.badgr_account.field_badgr_email', 'field.field.node.badgr_account.field_badgr_identifier', 'field.field.node.badgr_account.field_badgr_refresh_token', 'field.field.node.badgr_badges.body', 'field.field.node.badgr_badges.field_badge_account', 'field.field.node.badgr_badges.field_badge_earning_criteria', 'field.field.node.badgr_badges.field_badge_earning_url', 'field.field.node.badgr_badges.field_badge_entity_id', 'field.field.node.badgr_badges.field_badge_image', 'field.field.node.badgr_issuer.body', 'field.field.node.badgr_issuer.field_badge_account', 'field.field.node.badgr_issuer.field_badges_reference', 'field.field.node.badgr_issuer.field_issuer_contact_email', 'field.field.node.badgr_issuer.field_issuer_entity_id', 'field.field.node.badgr_issuer.field_issuer_image', 'field.field.node.badgr_issuer.field_issuer_website_url', 'field.storage.node.field_badge_account', 'field.storage.node.field_badge_earning_criteria', 'field.storage.node.field_badge_earning_url', 'field.storage.node.field_badge_entity_id', 'field.storage.node.field_badge_image', 'field.storage.node.field_badges_reference', 'field.storage.node.field_badgr_access_token', 'field.storage.node.field_badgr_email', 'field.storage.node.field_badgr_identifier', 'field.storage.node.field_badgr_refresh_token', 'field.storage.node.field_issuer_contact_email', 'field.storage.node.field_issuer_entity_id', 'field.storage.node.field_issuer_image', 'field.storage.node.field_issuer_website_url', 'node.type.badgr_account', 'node.type.badgr_badges', 'node.type.badgr_issuer', 'core.entity_view_display.node.badgr_issuer.default', 'core.entity_view_display.node.badgr_badges.teaser', 'core.entity_view_display.node.badgr_badges.default', 'core.entity_view_display.node.badgr_account.default', 'core.entity_form_display.node.badgr_issuer.default', 'core.entity_form_display.node.badgr_badges.default', 'core.entity_form_display.node.badgr_account.default', 'views.view.badgr_badges' ]; foreach ($configNames as $configName) { try { $configFactory->getEditable($configName)->delete(); } catch (\Exception $e) { $logger->warning(sprintf('Unable to uninstall config: %s.', $configName)); } } }