forked from easyting/ting_dk5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathting_dk5.admin.inc
More file actions
60 lines (50 loc) · 1.68 KB
/
ting_dk5.admin.inc
File metadata and controls
60 lines (50 loc) · 1.68 KB
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
<?php
/**
* @file
* Admin UI.
*/
/**
* Ting DK5 settings form builder.
*
* @ingroup forms
*
* @see system_settings_form()
*/
function ting_dk5_settings_admin_form($form, &$form_state) {
$form = array();
$form['ting_dk5_show_collection_list'] = array(
'#type' => 'checkbox',
'#title' => t('Show DK5 on collection page'),
'#default_value' => variable_get('ting_dk5_show_collection_list', FALSE),
'#description' => t("Check to show DK5 field on Ting collection page."),
);
$form['ting_dk5_show_default'] = array(
'#type' => 'checkbox',
'#title' => t('Show DK5 on item page'),
'#default_value' => variable_get('ting_dk5_show_default', FALSE),
'#description' => t("Check to show DK5 field on Ting item page."),
);
$form['ting_dk5_show_search_result'] = array(
'#type' => 'checkbox',
'#title' => t('Show DK5 in search result'),
'#default_value' => variable_get('ting_dk5_show_search_result', FALSE),
'#description' => t("Check to show DK5 field on search result page."),
);
$form['#submit'][] = 'ting_dk5_settings_admin_form_submit';
return system_settings_form($form);
}
/**
* Custom submit handler for admin form.
*
* @see ting_dk5_settings_admin_form()
*/
function ting_dk5_settings_admin_form_submit($form, &$form_state) {
$input = $form_state['input'];
$modes = array('default', 'search_result', 'collection_list');
$instance = field_info_instance('ting_object', 'ting_details_classification', 'ting_object');
foreach ($modes as $mode) {
$_mode = isset($input['ting_dk5_show_' . $mode]) ? $mode : '_hidden_';
$instance['display'][$mode] = ting_dk5_view_mode_settings($_mode);
}
field_update_instance($instance);
}