-
Notifications
You must be signed in to change notification settings - Fork 4
/
calendar.install
44 lines (41 loc) · 1.22 KB
/
calendar.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
<?php
/**
* @file
* Install, update and uninstall functions for the calendar module.
*
*/
function calendar_update_last_removed() {
return 7002;
}
/**
* Implements hook_install().
*/
function calendar_install() {
$config = config('calendar.settings');
foreach (node_type_get_types() as $type) {
$config->set('calendar_date_link_' . $type->type, '');
}
$config->save();
}
/**
* Migrate calendar settings from Drupal 7.
*/
function calendar_update_1000() {
$config = config('calendar.settings');
if ($config->isNew()) {
$config->set('track_date', update_variable_get('calendar_track_date', 0));
foreach (node_type_get_types() as $type) {
$config->set('calendar_date_link_' . $type->type, update_variable_get('calendar_date_link_' . $type->type));
update_variable_del('calendar_date_link_' . $type->type);
}
foreach (calendar_list_views() as $view => $data) {
// Nothing to convert since it'll depend on the layout and each layout
// could have one or more legend block.
update_variable_del('calendar_legend_view_' . $view);
}
$config->save();
}
// Delete variables.
update_variable_del('calendar_track_date');
update_variable_del('calendar_add_colorbox');
}