You are here

function thunder_demo_uninstall in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()
  2. 8.3 modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()
  3. 8.4 modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()
  4. 6.2.x modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()
  5. 6.0.x modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()
  6. 6.1.x modules/thunder_demo/thunder_demo.install \thunder_demo_uninstall()

Implements hook_uninstall().

Handling following steps:

  • Remove all tours from configuration.

File

modules/thunder_demo/thunder_demo.install, line 27
Contains.

Code

function thunder_demo_uninstall() {

  /** @var \Drupal\Core\Config\ConfigFactoryInterface $configFactory */
  $configFactory = \Drupal::configFactory();
  $logger = \Drupal::logger('thunder_demo');
  $tours = [
    'tour.tour.content-add',
    'tour.tour.content-list',
    'tour.tour.content-paragraphs',
    'tour.tour.homepage',
  ];
  foreach ($tours as $tour) {
    try {
      $configFactory
        ->getEditable($tour)
        ->delete();
    } catch (\Exception $e) {
      $logger
        ->warning(sprintf('Unable to uninstall tour: %s.', $tour));
    }
  }
}