uw_sites_all.install 895 Bytes
Newer Older
1 2 3 4 5 6 7
<?php

/**
 * @file
 * Install, update and uninstall for uWaterloo Site Controller.
 */

8 9 10
use Drupal\node\Entity\Node;
use Drupal\pathauto\PathautoState;

11 12 13 14 15 16
/**
 * Implements hook_install().
 */
function uw_sites_all_install() {
  \Drupal::service('theme_installer')->install(['uw_fdsu_theme_resp']);
  \Drupal::service('theme_handler')->setDefault('uw_fdsu_theme_resp');
17
  \Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

  // Create a Home web page with alias 'home'.
  $node = Node::create([
    'type' => 'uw_ct_web_page',
    'langcode' => 'en',
    'uid' => 1,
    'title' => 'Home',
    'path' => [
      'alias' => '/home',
      'pathauto' => PathautoState::SKIP,
    ],
  ]);
  $node->save();

  // Set the front page to 'home'.
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('page.front', '/home')
    ->save();
37
}