function notifications_content_test_template_form in Notifications 6.4
Same name and namespace in other branches
- 7 notifications_content/notifications_content.admin.inc \notifications_content_test_template_form()
Template testing form
1 string reference to 'notifications_content_test_template_form'
- notifications_content_menu in notifications_content/
notifications_content.module - Implementation of hook_menu_()
File
- notifications_content/
notifications_content.pages.inc, line 41 - Subscriptions to content events
Code
function notifications_content_test_template_form($form_state) {
global $user, $language;
module_load_include('admin.inc', 'notifications');
$message = !empty($form_state['values']['message']) ? $form_state['values']['message'] : NULL;
if ($message) {
$form['showmessage'] = array(
'#title' => t('Message'),
'#type' => 'item',
'#value' => _notifications_content_test_format_message(array(
'subect' => $message->subject,
'body' => $message->body,
)),
);
$form['showtemplate'] = array(
'#title' => t('Template parts'),
'#type' => 'item',
'#value' => _notifications_content_test_format_template($message->text_parts),
);
}
$form['type'] = array(
'#title' => t('Node type'),
'#type' => 'select',
'#options' => node_get_types('names'),
'#default_value' => isset($form_state['values']['type']) ? $form_state['values']['type'] : NULL,
);
$form['action'] = array(
'#title' => t('Action'),
'#type' => 'select',
'#options' => notifications_info('event actions'),
'#default_value' => isset($form_state['values']['action']) ? $form_state['values']['action'] : NULL,
);
$form['subscription_type'] = array(
'#title' => t('Subscription type'),
'#type' => 'select',
'#options' => notifications_subscription_types(NULL, 'title'),
'#default_value' => isset($form_state['values']['subscription_type']) ? $form_state['values']['subscription_type'] : NULL,
'#description' => t('Some modules may define a different template for their subscription types.'),
);
$form['send_method'] = array(
'#title' => t('Send method'),
'#type' => 'select',
'#options' => notifications_send_methods($user),
);
$form['language'] = array(
'#title' => t('Language'),
'#type' => 'select',
'#options' => messaging_template_language_list(),
'#default_value' => isset($form_state['values']['language']) ? $form_state['values']['language'] : $language->language,
);
$form['node'] = array(
'#title' => t('Select node'),
'#type' => 'textfield',
'#default_value' => isset($form_state['values']['node']) ? $form_state['values']['node'] : NULL,
'#description' => t("Enter a node id. If empty, a dummy node will be generated with title 'Test title' and body 'Test body line' (x 5 lines)"),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Try'),
'#submit' => array(
'notifications_content_test_template_submit',
),
'#description' => t('This test will generate fake events so only advised for development sites.'),
);
return $form;
}