You are here

thunder_demo.install in Thunder 8.4

Contains.

File

modules/thunder_demo/thunder_demo.install
View source
<?php

/**
 * @file
 * Contains.
 */

/**
 * Install thunder demo content.
 */
function thunder_demo_install() {

  // Set default pages.
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('page.403', '/node/3')
    ->set('page.404', '/node/4')
    ->save(TRUE);
}

/**
 * Implements hook_uninstall().
 *
 * Handling following steps:
 * - Remove all tours from configuration.
 */
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));
    }
  }
}

Functions

Namesort descending Description
thunder_demo_install Install thunder demo content.
thunder_demo_uninstall Implements hook_uninstall().