-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsimplify.admin.inc
100 lines (92 loc) · 3.58 KB
/
simplify.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
/**
* @file
* Administrative page callbacks for the Simplify module.
*/
/**
* Simplify global configuration form.
*/
function simplify_global_configuration_form($form, &$form_state) {
$config = config('simplify.global');
$form['#config'] = 'simplify.global';
// Nodes.
$form['nodes'] = array(
'#type' => 'fieldset',
'#title' => t('Nodes'),
'#description' => t("These fields will be hidden from <em>all</em> node forms. Alternatively, to hide fields from node forms of a particular content type, edit the content type and configure the hidden fields there."),
);
$form['nodes']['nodes'] = array(
'#type' => 'checkboxes',
'#title' => t('Hide:'),
'#options' => simplify_get_fields('nodes'),
'#default_value' => $config->get('nodes'),
);
// Users.
$form['users'] = array(
'#type' => 'fieldset',
'#title' => t('Users'),
'#description' => t("These fields will be hidden from all user account forms."),
);
$form['users']['users'] = array(
'#type' => 'checkboxes',
'#title' => t('Hide:'),
'#options' => simplify_get_fields('users'),
'#default_value' => $config->get('users'),
);
// Comments.
if (module_exists('comment')) {
$form['comments'] = array(
'#type' => 'fieldset',
'#title' => t('Comments'),
'#description' => t("These fields will be hidden from <em>all</em> comment forms. Alternatively, to hide fields from comment forms for nodes of a particular content type, edit the content type and configure the hidden fields there."),
);
$form['comments']['comments'] = array(
'#type' => 'checkboxes',
'#title' => t('Hide:'),
'#options' => simplify_get_fields('comments'),
'#default_value' => $config->get('comments'),
);
}
// Taxonomy.
if (module_exists('taxonomy')) {
$form['taxonomy'] = array(
'#type' => 'fieldset',
'#title' => t('Taxonomy'),
'#description' => t("These fields will be hidden from <em>all</em> taxonomy term forms. Alternatively, to hide fields from taxonomy term forms for a particular vocabulary, edit the vocabulary and configure the hidden fields there."),
);
$form['taxonomy']['taxonomy'] = array(
'#type' => 'checkboxes',
'#title' => t('Hide:'),
'#options' => simplify_get_fields('taxonomy'),
'#default_value' => $config->get('taxonomy'),
);
}
// Blocks.
if (module_exists('block')) {
$form['blocks'] = array(
'#type' => 'fieldset',
'#title' => t('Blocks'),
'#description' => t("These fields will be hidden from all block forms."),
);
$form['blocks']['blocks'] = array(
'#type' => 'checkboxes',
'#title' => t('Hide:'),
'#options' => simplify_get_fields('blocks'),
'#default_value' => $config->get('blocks'),
);
}
// Advanced settings.
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['advanced']['user1'] = array(
'#type' => 'checkbox',
'#title' => t('Hide fields from User 1'),
'#description' => t("By default, Backdrop gives User 1 <em>all</em> permissions (including Simplify's <em>View hidden fields</em> permission). This means that User 1 will always be able to view all hidden fields (and is by design).<br>Check this box to override this functionality and hide fields from User 1. NOTE: As this option overrides default Backdrop behaviour, it should be used sparingly and only when you fully understand the consequences."),
'#default_value' => $config->get('user1'),
);
return system_settings_form($form);
}