Commit 8fd328ed authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-3616: adding code to programatically add a web page called Home on...

ISTWCMS-3616: adding code to programatically add a web page called Home on install and set it is the homepage
parent e5ba7b9e
......@@ -5,6 +5,9 @@
* Install, update and uninstall for uWaterloo Site Controller.
*/
use Drupal\node\Entity\Node;
use Drupal\pathauto\PathautoState;
/**
* Implements hook_install().
*/
......@@ -12,4 +15,23 @@ function uw_sites_all_install() {
\Drupal::service('theme_installer')->install(['uw_fdsu_theme_resp']);
\Drupal::service('theme_handler')->setDefault('uw_fdsu_theme_resp');
\Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
// 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();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment