-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartesis_frontend.install
109 lines (94 loc) · 2.69 KB
/
artesis_frontend.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
* Installation of Artesis frontend features.
*/
/**
* Implements hook_install().
*/
function artesis_frontend_install() {
/*
* Create date formats used by frontend lists.
*/
$date_formats = artesis_frontend_get_date_formats();
foreach ($date_formats as $name => $format) {
// Create format definition.
db_insert('date_formats')->fields(array(
'format' => $format,
'type' => 'custom',
'locked' => 0,
))->execute();
// Create format types.
db_insert('date_format_type')->fields(array(
'type' => $name,
'title' => ucfirst(str_replace('_', ' ', $name)),
'locked' => 0,
))->execute();
// Create date format settings.
variable_set('date_format_' . $name, $format);
}
}
/**
* Implements hook_uninstall().
*/
function artesis_frontend_uninstall() {
/*
* Remove date formats created for frontend lists.
*/
$date_formats = artesis_frontend_get_date_formats();
foreach ($date_formats as $name => $format) {
// Remove format definition.
db_delete('date_formats')
->condition('format', $format)
->condition('type', 'custom')
->execute();
// Remove format types.
db_delete('date_format_type')
->condition('type', $name)
->condition('locked', 0)
->execute();
// Remove date format settings.
variable_del('date_format_' . $name);
}
}
function artesis_frontend_get_date_formats() {
return array(
'year_only' => 'Y',
'reverse_date' => 'Y-m-d',
'month_only' => 'F',
'day_only' => 'j',
'date_with_day_of_week' => 'D, j.m.Y',
'date_and_month_only' => 'j F',
'short_month_only' => 'M',
'date_combined' => 'd/m-Y',
);
}
/**
* Enable default "Taxonomy term" view for feeds.
*/
function artesis_frontend_update_7000() {
$status = variable_get('views_defaults', array());
$status['taxonomy_term'] = FALSE;
variable_set('views_defaults', $status);
}
/**
* Enable 'user-scalability' theme setting.
*/
function artesis_frontend_update_7001(&$sandbox) {
$alpha_base_settings = variable_get('theme_alpha_basetheme_settings', []);
$alpha_base_settings['alpha_viewport_user_scaleable'] = (int) 1;
variable_set('theme_alpha_basetheme_settings', $alpha_base_settings);
$domains = domain_domains();
foreach ($domains as $domain) {
$theme = domain_theme_lookup($domain['domain_id']);
$settings = domain_unserialize($theme['settings']);
$settings['alpha_viewport_user_scaleable'] = (int) 1;
db_update('domain_theme')
->fields(['settings' => serialize($settings)])
->condition('domain_id', $domain['domain_id'])
->condition('status', 1)
->execute();
}
cache_clear_all();
drupal_theme_rebuild();
}