-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathasu_brand.install
122 lines (107 loc) · 3.33 KB
/
asu_brand.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
<?php
/**
* Implements hook_install().
*/
function asu_brand_install() {
variable_set('asu_brand_ci_testing', 0);
}
/**
* Implements hook_uninstall().
*/
function asu_brand_uninstall() {
drupal_load('module', 'asu_brand');
// Delete all module variables.
db_delete('variable')->condition('name', 'asu_brand%', 'LIKE')->execute();
cache_clear_all('variables', 'cache_bootstrap');
// Delete caches.
foreach (asu_brand_get_cache_ids() as $cache_id) {
cache_clear_all($cache_id, 'cache');
}
}
/**
* Implements hook_update_N().
*
* Set footer color variable to '' if it equals '_black' which is the actual
* value for the black footer.
*/
function asu_brand_update_7100(&$sandbox) {
$footer_color = variable_get('asu_brand_footer_color', ASU_BRAND_FOOTER_COLOR_DEFAULT);
if ($footer_color = '_black') {
variable_set('asu_brand_footer_color', '');
cache_clear_all('asu_brand:footer', 'cache');
}
}
/**
* Implements hook_update_N()
* + Updates header variables if Innovation theme is selected
* + Re-add footer block to all pages
*/
function asu_brand_update_7101(&$sandbox) {
$theme = 'innovation';
if (variable_get('theme_default') === $theme) {
// re-add footer after removal from mega footer module
$asu_brand_footer_bid = db_query("SELECT bid FROM {block} WHERE delta = :delta AND theme = :theme", array(
':delta' => 'asu_brand_footer',
':theme' => $theme
))->fetchField();
db_query("UPDATE {block} SET status = :status WHERE bid = :bid AND theme = :theme", array(
':status' => 1,
':bid' => $asu_brand_footer_bid,
':theme' => $theme
));
db_query("UPDATE {block} SET region = :region WHERE bid = :bid AND theme = :theme", array(
':region' => 'footer',
':bid' => $asu_brand_footer_bid,
':theme' => $theme
));
// updates header vars
variable_set('asu_brand_header_selector', 'default');
variable_set('asu_brand_header_template', 'default');
variable_set('asu_brand_header_version', '4.4');
variable_set('asu_brand_header_basepath', 'http://www.asu.edu/asuthemes');
}
}
/**
* Implements hook_update_N()
* + Updates ASU Header to v4.5
*/
function asu_brand_update_7102(&$sandbox) {
if (variable_get('theme_default') === 'innovation') {
variable_set('asu_brand_header_version', '4.5');
}
}
/**
* Implements hook_update_N()
* + Adds Behat testing variable to turn off GTM during Behat testing
*/
function asu_brand_update_7103(&$sandbox) {
variable_set('asu_brand_ci_testing', 0);
}
/**
* Implements hook_update_N()
* + Updates ASU Header to v4.5 for all remaining non-Webspark Innovation users
*/
function asu_brand_update_7104(&$sandbox) {
variable_set('asu_brand_header_version', '4.5');
}
/**
* Implements hook_update_N()
* + Updates ASU Header to stable
*/
function asu_brand_update_7105(&$sandbox) {
variable_set('asu_brand_header_version', 'stable');
}
/**
* Implements hook_update_N()
* + Disable display of site name by Drupal, since the brand header is now handling it
*/
function asu_brand_update_7106(&$sandbox) {
variable_set('asu_brand_header_version', 'stable');
$themes = list_themes();
foreach ($themes AS $key => $item) {
$theme_key = 'theme_'.$key.'_settings';
$settings = variable_get($theme_key, array());
$settings['toggle_name'] = FALSE;
variable_set($theme_key, $settings);
}
}