-
Notifications
You must be signed in to change notification settings - Fork 1
/
od_mapv.admin.inc
executable file
·100 lines (98 loc) · 3.6 KB
/
od_mapv.admin.inc
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
<?php
/**
* Settings form.
*/
function od_mapv_settings_form() {
$form['od_mapv_display_fs'] = array(
'#type' => 'fieldset',
'#title' => t('Display options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['od_mapv_display_fs']['od_mapv_display_filter'] = array(
'#type' => 'checkbox',
'#title' => t('Filter'),
'#default_value' => variable_get('od_mapv_display_filter', OD_MAPV_DEFAULT_DISPLAY_FILTER),
);
$form['od_mapv_display_fs']['od_mapv_display_content'] = array(
'#type' => 'checkbox',
'#title' => t('Content'),
'#default_value' => variable_get('od_mapv_display_content', OD_MAPV_DEFAULT_DISPLAY_CONTENT),
);
$form['od_mapv_display_fs']['od_mapv_display_width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => variable_get('od_mapv_display_width', OD_MAPV_DEFAULT_DISPLAY_WIDTH),
);
$form['od_mapv_display_fs']['od_mapv_display_height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => variable_get('od_mapv_display_height', OD_MAPV_DEFAULT_DISPLAY_HEIGHT),
);
$form['od_mapv_display_fs']['od_mapv_display_title'] = array(
'#type' => 'textfield',
'#title' => t('Head title'),
'#default_value' => variable_get('od_mapv_display_title', 'od_mapv'),
);
$form['od_mapv_text'] = array(
'#type' => 'fieldset',
'#title' => t('Text'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['od_mapv_text']['od_mapv_text_tooltip'] = array(
'#type' => 'textfield',
'#title' => t('Tooltip'),
'#description' => t('This text will be the suffix of tooltip text.'),
'#default_value' => variable_get('od_mapv_text_tooltip', ''),
);
$form['od_mapv_text']['od_mapv_text_result'] = array(
'#type' => 'textfield',
'#title' => t('Result'),
'#description' => t('!search is a text search. !number is number of items found.'),
'#default_value' => variable_get('od_mapv_text_result', t('Result in !search found !number'))
);
$form['od_mapv_src'] = array(
'#type' => 'fieldset',
'#title' => t('Source'),
'#collapsible' => TRUE,
);
$form['od_mapv_src']['od_mapv_file_path'] = array(
'#type' => 'textfield',
'#title' => t('DB csv filepath'),
'#default_value' => variable_get('od_mapv_file_path', OD_MAPV_DEFAULT_FILE_PATH),
);
$form['od_mapv_src']['od_mapv_map_file_path'] = array(
'#type' => 'textfield',
'#title' => t('Map SVG filepath'),
'#default_value' => variable_get('od_mapv_map_file_path', OD_MAPV_DEFAULT_MAP_FILE_PATH),
);
$form['od_mapv_src']['od_mapv_swf_file_path'] = array(
'#type' => 'textfield',
'#title' => t('Map SWF filepath'),
'#default_value' => variable_get('od_mapv_swf_file_path', OD_MAPV_DEFAULT_SWF_FILE_PATH),
);
$form['od_mapv_src']['od_mapv_type'] = array(
'#type' => 'select',
'#title' => t('From content type'),
'#options' => array('' => '- None -') + node_get_types('names'),
'#default_value' => variable_get('od_mapv_type', NULL),
);
$form['od_mapv_link_path'] = array(
'#type' => 'textfield',
'#title' => t('Link path to map'),
'#default_value' => variable_get('od_mapv_link_path', 'od_mapv'),
);
$form = system_settings_form($form);
$form['#submit'][] = 'od_mapv_settings_form_submit';
return $form;
}
/**
* Settings form submit.
*/
function od_mapv_settings_form_submit($form, $form_state) {
if (variable_get('od_mapv_link_path', 'od_mapv') != $form_state['values']['od_mapv_link_path'] ||
variable_get('od_mapv_display_title', 'od_mapv') != $form_state['values']['od_mapv_display_title']) {
cache_clear_all();
}
}