-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgt_profile.install
81 lines (68 loc) · 1.87 KB
/
gt_profile.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* @file
* Install, update and uninstall functions for the gt installation profile.
*/
use Drupal\user\RoleInterface;
use Drupal\user\UserInterface;
use Symfony\Component\Yaml\Yaml;
use Drupal\block\Entity\Block;
/**
* Implements hook_preprocess_install_page().
*/
function gt_profile_preprocess_install_page(&$variables) {
$variables['#attached']['library'][] = 'gt/gt-installer';
}
function gt_profile_install() {
/**
* The basics
*/
// Set front page to "node".
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/node')
->save(true);
// Only admins can create new users
\Drupal::configFactory()
->getEditable('user.settings')
->set('register', UserInterface::REGISTER_ADMINISTRATORS_ONLY)
->save(true);
// Set the GT 3.x Theme as the Default Theme and the Claro Theme as the Admin Theme
\Drupal::configFactory()
->getEditable('system.theme')
->set('admin', 'claro')
->set('default', 'gt')
->save(TRUE);
\Drupal::configFactory()
->getEditable('node.settings')
->set('use_admin_theme', true)
->save(true);
// Default language
\Drupal::configFactory()
->getEditable('system.site')
->set('langcode', 'en')
->save(true);
\Drupal::configFactory()
->getEditable('system.site')
->set('default_langcode', 'en')
->save(true);
// Disable Personal Contact Forms
\Drupal::service('config.factory')
->getEditable('contact.settings')
->set('user_default_enabled', 'false')
->save();
// Permissions for anonymous role
$anon_permissions = [
'access content',
'search content',
'view media',
];
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, $anon_permissions);
// Permissions for authenticated role
$auth_perms = [
'access content',
'search content',
'use text format basic_html',
'view media',
];
}