-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartesis_frontend.install
90 lines (79 loc) · 2.05 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
<?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 artesis frontend overrides.
*/
function artesis_frontend_update_7001() {
module_enable(array('artesis_frontend_overrides'));
}