This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uh_mece.admin.inc
70 lines (64 loc) · 2.14 KB
/
uh_mece.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
<?php
/**
* @license GPL, or GNU General Public License, version 3
* @license http://opensource.org/licenses/GPL-3.0
* @see README.md how to contribute to this project
*/
/**
* Callback for configuration form.
*/
function uh_mece_configuration() {
$form = array();
// General settings
$form['uh_mece'] = array(
'#type' => 'fieldset',
'#title' => t('General settings'),
'uhc_mece_expire' => array(
'#title' => t('Offset expire'),
'#description' => t('Enter number of seconds when messages should expire. By default it\'s 1 month in seconds.'),
'#type' => 'textfield',
'#default_value' => variable_get('uhc_mece_expire', 60*60*24*30),
),
);
// REST server connection
$form['uh_mece_http'] = array(
'#type' => 'fieldset',
'#title' => t('REST server connection configuration'),
'uh_mece_http_endpoint_url' => array(
'#title' => t('Endpoint URL'),
'#description' => t('Type in endpoint URL where messages should be sent to.'),
'#type' => 'textfield',
'#default_value' => variable_get('uh_mece_http_endpoint_url', ''),
),
'uh_mece_http_method' => array(
'#type' => 'select',
'#title' => t('Submission HTTP method'),
'#description' => t('Select the method you would like to use for sending messages.'),
'#options' => array(
'POST' => 'POST',
'PUT' => 'PUT',
),
'#default_value' => variable_get('uh_mece_http_method', 'POST'),
),
);
// Authentication / identity
$form['uh_mece_auth'] = array(
'#type' => 'fieldset',
'#title' => t('Authentication configuration'),
'uh_mece_auth_source' => array(
'#title' => t('Identity: Source'),
'#description' => t('Which "source" you want to ship the message as.'),
'#type' => 'textfield',
'#default_value' => variable_get('uh_mece_auth_source', ''),
),
);
return system_settings_form($form);
}
/**
* Validation callback for configuration.
*/
function uh_mece_configuration_validate(&$form, &$form_state) {
if (!is_numeric($form_state['values']['uhc_mece_expire'])) {
form_set_error('uhc_mece_expire', t('Expire must be numerical value'));
}
}