-
Notifications
You must be signed in to change notification settings - Fork 1
/
localgov_demo.install
62 lines (53 loc) · 2.09 KB
/
localgov_demo.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @file
* Install, update and uninstall functions for the localgov_demo module.
*/
use Drupal\menu_link_content\Entity\MenuLinkContent;
/**
* Implements hook_install().
*/
function localgov_demo_install() {
// Enable area geo bundle in directory venue content type..
$localgov_directories_venue_config = \Drupal::service('config.factory')->getEditable('field.field.node.localgov_directories_venue.localgov_location');
$localgov_directories_venue_config->set('settings.handler_settings.target_bundles.area', 'area');
$localgov_directories_venue_config->save();
// Set demo front page.
$system_site = \Drupal::configFactory()->getEditable('system.site');
$system_site->set('page.front', '/localgov-drupal-demo');
$system_site->save();
drupal_flush_all_caches();
// Disable unwanted blocks from localgov_base and localgov_scarfolk.
$blocks_to_disable = [
'block.block.views_block__services_block_service_list_base',
'block.block.views_block__services_block_service_list_scarfolk',
'block.block.localgov_home_welcome_block_base',
'block.block.localgov_home_welcome_block_scarfolk',
];
foreach ($blocks_to_disable as $block_id) {
// Load block and set disabled.
$services_home_block = \Drupal::configFactory()->getEditable($block_id);
$services_home_block->set('region', 'disabled');
$services_home_block->save();
}
// Set weight of localgov_alert_banner block to float up above the banner.
$alert_banner_block = \Drupal::configFactory()->getEditable('block.block.localgov_alert_banner');
$alert_banner_block->set('weight', '-10');
$alert_banner_block->save();
// Create a link to Docs.
$news_menu_item = MenuLinkContent::create([
'title' => 'Docs',
'link' => ['uri' => 'https://localgovdrupal.org/'],
'menu_name' => 'main',
'expanded' => FALSE,
]);
$news_menu_item->save();
// Create a link to GitHub.
$events_menu_item = MenuLinkContent::create([
'title' => 'GitHub',
'link' => ['uri' => 'https://github.com/localgovdrupal/'],
'menu_name' => 'main',
'expanded' => FALSE,
]);
$events_menu_item->save();
}