-
Notifications
You must be signed in to change notification settings - Fork 0
/
hidden_catalog.install
114 lines (113 loc) · 2.98 KB
/
hidden_catalog.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
<?php
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function hidden_catalog_install() {
// Enable some hidden_catalog blocks.
$default_theme = 'hideio';
$admin_theme = 'adminimal';
// 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('theme_default', $default_theme);
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,
),
);
if ($default_theme !== $admin_theme) {
$admin_blocks = array(
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,
),
);
$blocks = array_merge($blocks, $admin_blocks);
}
// 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();
// Update the menu router information.
menu_rebuild();
// revert features to ensure they are all installed
$features = array(
'hidden_catalog_taxonomy',
'hidden_catalog_types',
'hidden_catalog_views',
'hidden_catalog_tweaks',
'hidden_catalog_roles'
);
features_revert($features);
// ignore any rebuild messages
node_access_needs_rebuild(FALSE);
// ignore any other install messages
drupal_get_messages();
}