-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathsocial.install
76 lines (65 loc) · 2.06 KB
/
social.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
<?php
/**
* @file
* Install, update and uninstall functions for the social installation profile.
*/
use Drupal\user\Entity\User;
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function social_install() {
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/stream')
->save(TRUE);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
$user->save();
// Disable secondary toolbar on frontend in Gin theme.
_social_core_disable_secondary_gin_toolbar();
}
/**
* Implements hook_requirements().
*/
function social_requirements($phase) : array {
$requirements = [];
switch ($phase) {
case 'install':
// We don't care how Drupal configures the private file system (e.g.
// through a setting or otherwise), we just care that our `private` uri
// scheme for our file field storages works.
if (!in_array('private', stream_get_wrappers(), TRUE)) {
$requirements['private_file_system'] = [
'title' => t('Private File System'),
'value' => t('Not configured'),
'description' => t('The private file system must be configured for Open Social to install. You may opt-out of the private file system for individual fields after installation. See https://www.drupal.org/documentation/modules/file for how to set the file_private_path in your settings.php.'),
'severity' => REQUIREMENT_ERROR,
];
}
break;
}
return $requirements;
}
/**
* Disable secondary toolbar on frontend in Gin theme.
*/
function _social_core_disable_secondary_gin_toolbar() {
$config = \Drupal::configFactory()->getEditable('gin.settings');
if (!empty($config->getRawData())) {
\Drupal::configFactory()
->getEditable('gin.settings')
->set('secondary_toolbar_frontend', FALSE)
->save(TRUE);
}
}
/**
* Disable secondary toolbar on frontend in Gin theme.
*/
function social_update_11501() {
_social_core_disable_secondary_gin_toolbar();
}