-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb3_standard.install
295 lines (283 loc) · 8.14 KB
/
web3_standard.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function web3_standard_install() {
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
// Add text formats.
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 1,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// HTML filter.
'filter_html' => array(
'weight' => 1,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 2,
'status' => 1,
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
$full_html_format = array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 0,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 1,
'status' => 1,
),
// Media filter.
'media_filter' => array(
'weight' => 9,
'status' => 1,
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$full_html_format = (object) $full_html_format;
filter_format_save($full_html_format);
$default_theme = 'bartik';
$admin_theme = 'shiny';
// disable all themes
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->execute();
// enable $default_theme
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $default_theme)
->execute();
// enable $admin_theme
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $admin_theme)
->execute();
variable_set('admin_theme', $admin_theme);
// activate admin theme when editing a node
variable_set('node_admin_theme', '1');
$blocks = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'user',
'delta' => 'login',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => -10,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
// Insert default pre-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
array(
'type' => 'article',
'name' => st('Article'),
'base' => 'node_content',
'description' => st('Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
// Default "Basic page" to not be promoted.
variable_set('node_options_page', array('status'));
// Don't display date and author information for "Basic page" nodes by default.
variable_set('node_submitted_page', FALSE);
// Set article menu default settings to no menu.
variable_set('menu_options_article', array());
variable_set('menu_parent_article', 'main-menu:0');
// drop system / user blocks to ensure correct building
db_delete('block')->condition('module', 'system')->execute();
db_delete('block')->condition('module', 'user')->execute();
// add in our blocks defined above
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($blocks as $block) {
$query->values($block);
}
$query->execute();
// Enable default permissions for system roles.
$filtered_html_permission = filter_permission_name($filtered_html_format);
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', $filtered_html_permission));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', $filtered_html_permission));
// Create a default role for site editors, with all available permissions assigned.
$editor_role = new stdClass();
$editor_role->name = 'editor';
$editor_role->weight = 3;
user_role_save($editor_role);
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 2;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array('uid' => 1, 'rid' => $admin_role->rid))
->execute();
// Create a Home link in the main menu.
$item = array(
'link_title' => st('Home'),
'link_path' => '<front>',
'menu_name' => 'main-menu',
);
menu_link_save($item);
// Exported profile: full_html
$full_html_wysiwyg = array(
'default' => 1,
'user_choose' => 0,
'show_toggle' => 1,
'theme' => 'advanced',
'language' => 'en',
'buttons' => array(
'default' => array(
'Bold' => 1,
'Italic' => 1,
'Underline' => 1,
'JustifyLeft' => 1,
'JustifyCenter' => 1,
'JustifyRight' => 1,
'JustifyBlock' => 1,
'BidiLtr' => 1,
'BidiRtl' => 1,
'BulletedList' => 1,
'NumberedList' => 1,
'Undo' => 1,
'Redo' => 1,
'Link' => 1,
'Unlink' => 1,
'Anchor' => 1,
'Source' => 1,
'Copy' => 1,
'Paste' => 1,
'PasteText' => 1,
'RemoveFormat' => 1,
'FontSize' => 1,
'Table' => 1,
),
'drupal' => array(
'media' => 1,
),
'pasteformat' => array(
'pasteformat' => 1,
),
),
'toolbar_loc' => 'top',
'toolbar_align' => 'left',
'path_loc' => 'bottom',
'resizing' => 1,
'verify_html' => 1,
'preformatted' => 0,
'convert_fonts_to_spans' => 1,
'remove_linebreaks' => 1,
'apply_source_formatting' => 0,
'paste_auto_cleanup_on_paste' => 1,
'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div',
'css_setting' => 'theme',
'css_path' => '',
'css_classes' => '',
);
$wysiwyg = db_insert('wysiwyg')->fields(array(
'format' => 'full_html',
'editor' => 'ckeditor',
'settings' => serialize($full_html_wysiwyg)
))
->execute();
// Update the menu router information.
menu_rebuild();
// ignore any rebuild messages
node_access_needs_rebuild(FALSE);
// ignore any other install messages
drupal_get_messages();
variable_set('pathauto_node_pattern', '[node:title]');
variable_set('pasteformat_cleanup_format', 'full_html');
}