-
Notifications
You must be signed in to change notification settings - Fork 3
/
campaignion_starterkit.install
109 lines (96 loc) · 2.95 KB
/
campaignion_starterkit.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* @file
* Settings for installing the campaignion_starterkit profile.
*/
/**
* Implements hook_install().
*/
function campaignion_starterkit_install() {
_campaignion_starterkit_themes();
_campaignion_starterkit_set_variables();
_campaignion_starterkit_add_european_languages();
$devel = isset($GLOBALS['install_state']['forms']['mo_devel_flag']);
if ($devel) {
$devel_modules = [
"coffee",
"context_ui",
"devel",
"devel_generate",
"field_ui",
"views_ui",
];
module_enable($devel_modules);
variable_set('devel_debug_mail_directory', '/tmp/devel-mails/');
}
_campaignion_starterkit_frontpage();
}
/**
* Sets available languages.
*/
function _campaignion_starterkit_add_european_languages() {
foreach (['ba', 'be', 'bg', 'br', 'bs', 'ca', 'ce', 'co', 'cs', 'cv', 'cy',
'da', 'de', 'dv', 'el', 'es', 'et', 'eu', 'fi', 'fo', 'fr', 'fy', 'ga',
'gd', 'gl', 'gsw-berne', 'hr', 'hu', 'hy', 'is', 'it', 'ka', 'kl', 'kv',
'lb', 'lt', 'lv', 'mk', 'mo', 'mt', 'nl', 'nb', 'nn', 'oc', 'os', 'pl',
'pt', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sv', 'tt', 'uk', 'yi',
] as $lc) {
locale_add_language($lc, NULL, NULL, LANGUAGE_LTR, '', '', 0);
}
}
/**
* Sets variables.
*/
function _campaignion_starterkit_set_variables() {
variable_set('clientside_validation_path_list', 'admin/structure/views/*');
variable_set('clientside_validation_override_jquery_form', '1');
variable_set('pathauto_node_pattern', '[node:title]');
// User registration is admin only per default.
variable_set('user_register', '0');
variable_set('campaignion_bar_file', drupal_get_path('module', 'campaignion_starterkit') . '/campaignion_bar.txt');
variable_set('jquery_update_jquery_version', '1.8');
}
/**
* Sets themes.
*/
function _campaignion_starterkit_themes() {
theme_enable(['ae_admin', 'ae_base', 'campaignion_foundation']);
variable_set('theme_default', 'campaignion_foundation');
variable_set('admin_theme', 'ae_admin');
variable_set('node_admin_theme', 1);
}
/**
* Sets default frontpage.
*/
function _campaignion_starterkit_frontpage() {
module_load_include('module', 'node');
$node = (object) [
'title' => 'Let\'s change the world!',
'type' => 'static_page',
'comment' => 0,
];
node_object_prepare($node);
node_save($node);
variable_set('site_frontpage', 'node/' . $node->nid);
}
/* ######################## UPDATES ########################## */
/**
* Switch to campaignion_foundist as default theme.
*/
function campaignion_starterkit_update_3() {
variable_set('theme_default', 'campaignion_foundation');
}
/**
* Update jQuery to 1.8.
*/
function campaignion_starterkit_update_2() {
variable_set('jquery_update_jquery_version', '1.8');
}
/**
* Activate `campaignion_share_page`.
*/
function campaignion_starterkit_update_1() {
if (!module_enable(['campaignion_share_page'], TRUE)) {
throw new DrupalUpdateException('Unable to enable campaignion_share_page.');
}
}