-
Notifications
You must be signed in to change notification settings - Fork 0
/
nice_menus.install
50 lines (44 loc) · 2.19 KB
/
nice_menus.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
<?php
/**
* @file
* Update functions for Nice menus.
*/
/**
* Convert module settings to use configuration files.
*/
function nice_menus_update_1000() {
// Get the number of custom menus installed.
$number = update_variable_get('nice_menus_number', '2');
// Migrate variables to config.
$config = config('nice_menus.settings');
$config->set('nice_menus_number', update_variable_get('nice_menus_number', 2));
$config->set('nice_menus_js', update_variable_get('nice_menus_js', 1));
$config->set('nice_menus_sf_delay', update_variable_get('nice_menus_sf_delay', 800));
$config->set('nice_menus_sf_speed', update_variable_get('nice_menus_sf_speed', 'slow'));
$config->set('nice_menus_custom_css', update_variable_get('nice_menus_custom_css', ''));
$config->set('menu_main_links_source', update_variable_get('menu_main_links_source', 'main-menu'));
$config->set('menu_secondary_links_source', update_variable_get('menu_secondary_links_source', 'user-menu'));
// Set config for all custom menus.
for ($i = 1; $i <= $number; $i++) {
$config->set('nice_menus_name_' . $i, update_variable_get('nice_menus_name_' . $i, 'Nice menu ' . $i));
$config->set('nice_menus_menu_' . $i, update_variable_get('nice_menus_menu_' . $i, 'management:0'));
$config->set('nice_menus_depth_' . $i, update_variable_get('nice_menus_depth_' . $i, -1));
$config->set('nice_menus_type_' . $i, update_variable_get('nice_menus_type_' . $i, 'right'));
$config->set('nice_menus_respect_expand_' . $i, update_variable_get('nice_menus_respect_expand_' . $i, 0));
}
$config->save();
update_variable_del('nice_menus_number');
update_variable_del('nice_menus_js');
update_variable_del('nice_menus_sf_delay');
update_variable_del('nice_menus_sf_speed');
update_variable_del('nice_menus_custom_css');
update_variable_del('menu_main_links_source');
update_variable_del('menu_secondary_links_source');
for ($i = 1; $i <= $number; $i++) {
update_variable_del('nice_menus_name_' . $i);
update_variable_del('nice_menus_menu_' . $i);
update_variable_del('nice_menus_depth_' . $i);
update_variable_del('nice_menus_type_' . $i);
update_variable_del('nice_menus_respect_expand_' . $i);
}
}