-
Notifications
You must be signed in to change notification settings - Fork 2
/
content_lock.admin.inc
86 lines (76 loc) · 3.57 KB
/
content_lock.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
<?php
/**
* @file
* Content lock module admin page.
*/
/**
* Providing an administration interface for content_lock.
*/
function content_lock_admin_settings() {
$config = config('content_lock.settings');
$form = array();
$form['#config'] = 'content_lock.settings';
$form['#attached'] = array(
'js' => array(
backdrop_get_path('module', 'content_lock') . '/content_lock.admin.js',
),
);
$form['content_lock_unload_js'] = array(
'#type' => 'checkbox',
'#title' => t('Use javascript to detect leaving the node form'),
'#description' => t('If you disable this, nodes will remain locked if the user navigates away from the node without saving it or clicking the cancel button.'),
'#default_value' => $config->get('content_lock_unload_js'),
);
$form['content_lock_unload_js_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Javascript detection options.'),
);
$form['content_lock_unload_js_fieldset']['content_lock_unload_js_message_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Confirm that the user really wants to leave the node form with a Javascript popup'),
'#description' => t('This will cause a Javascript popup to ask the user if navigating away from the node edit page is intentional, giving the user an opportunity to cancel navigation so that the changes to the node may be saved. This will not appear if the user clicks the cancel button.'),
'#default_value' => $config->get('content_lock_unload_js_message_enable'),
);
$form['content_lock_unload_js_fieldset']['content_lock_unload_js_message'] = array(
'#type' => 'textfield',
'#title' => t('Javascript popup message text'),
'#description' => t('This option allows you to modify the text the user sees when navigating away from an edited node.'),
'#default_value' => $config->get('content_lock_unload_js_message'),
);
$form['content_lock_admin_verbose'] = array(
'#type' => 'checkbox',
'#title' => t('Show lock / unlock messages'),
'#description' => t('This option controls whether or not content_lock inform the user that he has locked/unlocked a node. This does not control the javascript dialogues.'),
'#default_value' => $config->get('content_lock_admin_verbose'),
);
$form['content_lock_admin_cancelbutton'] = array(
'#type' => 'checkbox',
'#title' => t('Add cancel button'),
'#description' => t('Adds a cancel button to the node / user / comment form. This way a user can properly cancel the transaction.'),
'#default_value' => $config->get('content_lock_admin_cancelbutton'),
);
$node_types = array();
foreach (node_type_get_types() as $node_type_name => $node_type) {
$node_types[$node_type_name] = $node_type->name;
}
$form['content_lock_allowed_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Lockable content types'),
'#description' => t('Apply lock to the selected content types. Leave blank for all node types to be lockable.'),
'#options' => $node_types,
'#default_value' => $config->get('content_lock_allowed_node_types'),
);
$formats = filter_formats();
$format_options = array();
foreach ($formats as $id => $format) {
$format_options[$id] = $format->name;
}
$form['content_lock_allowed_formats'] = array(
'#type' => 'checkboxes',
'#title' => t('Lockable text formats'),
'#description' => t('Apply lock to selected formats only. Leave blank for all node input formats to be lockable.'),
'#options' => $format_options,
'#default_value' => $config->get('content_lock_allowed_formats'),
);
return system_settings_form($form);
}