function messaging_admin_settings in Messaging 5
Same name and namespace in other branches
- 6.4 messaging.admin.inc \messaging_admin_settings()
- 6 messaging.admin.inc \messaging_admin_settings()
- 6.2 messaging.admin.inc \messaging_admin_settings()
- 6.3 messaging.admin.inc \messaging_admin_settings()
- 7 messaging.admin.inc \messaging_admin_settings()
Admin settings form
2 string references to 'messaging_admin_settings'
- messaging_debug_form_alter in messaging_debug/
messaging_debug.module - Implementation of hook_form_alter()
- messaging_menu in ./
messaging.module - Implementation of hook_menu()
File
- ./
messaging.module, line 288
Code
function messaging_admin_settings() {
// Get plug-in information and produce big warning if none enabled.
$methods = messaging_method_list();
if (!$methods) {
drupal_set_message(t('No sending method plug-ins available. Please enable some Sending Method on the !admin-modules page.', array(
'!admin-modules' => l(t('Modules administration'), 'admin/build/modules'),
)), 'error');
}
$form['general'] = array(
'#type' => 'fieldset',
'#title' => t('General settings'),
);
$form['general']['messaging_default_method'] = array(
'#title' => t('Default send method'),
'#type' => 'radios',
'#options' => $methods,
'#default_value' => variable_get('messaging_default_method', ''),
);
// Logging settings
$period = array(
0 => t('Disabled'),
) + drupal_map_assoc(array(
3600,
10800,
21600,
32400,
43200,
86400,
172800,
259200,
604800,
1209600,
2419200,
4838400,
9676800,
), 'format_interval');
$form['general']['messaging_log'] = array(
'#title' => t('Logging'),
'#type' => 'select',
'#options' => $period,
'#default_value' => variable_get('messaging_log', 0),
'#description' => t('If enabled all messages will be logged and kept for the specified time after they\'re sent.'),
);
// Sending methods settings
$form['messaging_methods'] = array(
'#type' => 'fieldset',
'#title' => t('Settings for messaging methods'),
'#collapsible' => TRUE,
'#description' => t('Depending on your content format and the tokens you are using for messages it is important that you use the right filtering for the message body.') . ' ' . t('Set up the filters you need using the !input_formats page', array(
'!input_formats' => l('Input Formats', 'admin/settings/filters'),
)),
);
if ($info = messaging_method_info()) {
foreach (filter_formats() as $format) {
$format_options[$format->format] = $format->name;
}
// We add this last for it not bo be default
$format_options[0] = t('None (Insecure)');
foreach ($info as $method => $options) {
$key = 'messaging_method_' . $method;
// This will preserve settings for disabled modules
$form['messaging_methods'][$key] = array(
'#type' => 'fieldset',
'#title' => t('!name settings', array(
'!name' => $options['name'],
)),
'#tree' => TRUE,
);
// Output filter applied to message body
$form['messaging_methods'][$key]['filter'] = array(
'#type' => 'select',
'#title' => t('Message body filter'),
'#default_value' => isset($options['filter']) ? $options['filter'] : variable_get('messaging_default_filter', ''),
'#options' => $format_options,
);
}
}
else {
$form['messaging_methods']['warning'] = array(
'#value' => t('You should enable some messaging method plug-ins for this to work.'),
);
}
// Processing limits
$limit = variable_get('messaging_process_limit', array(
'message' => 0,
'percent' => 0,
'time' => 0,
));
$form['messaging_process_limit'] = array(
'#type' => 'fieldset',
'#title' => t('Limits for queue processing'),
'#tree' => TRUE,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('These are the limits for each cron run on queue processing. The process will stop when it first meets any of them. Set to 0 for no limit.'),
);
$form['messaging_process_limit']['message'] = array(
'#title' => t('Number of messages sent'),
'#type' => 'textfield',
'#size' => 10,
'#default_value' => $limit['message'],
);
$form['messaging_process_limit']['time'] = array(
'#title' => t('Time (seconds)'),
'#type' => 'textfield',
'#size' => 10,
'#default_value' => $limit['time'],
);
$form['messaging_process_limit']['percent'] = array(
'#title' => t('Time (% of cron time)'),
'#type' => 'textfield',
'#size' => 10,
'#default_value' => $limit['percent'],
'#description' => t('Maximum percentage of cron time the process may use.'),
);
return system_settings_form($form);
}