function _views_send_filter_form in Views Send 6
This is a fork of filter_form() in order to allow adding the "Plain" option.
Parameters
The ID of the format that is currently selected.:
Return value
Form API array for the form element.
See also
http://api.drupal.org/api/function/filter_form/6
1 call to _views_send_filter_form()
- views_send_mail_action_form in ./
views_send.module - Configuration form for views_send_mail action.
File
- ./
views_send.module, line 593 - The Views Send module.
Code
function _views_send_filter_form($default_value) {
$form = array();
$parents = array(
'format',
);
// Format wrapper.
$form = array(
'#type' => 'fieldset',
'#title' => t('Message format'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#element_validate' => array(
'filter_form_validate',
),
);
$guidelines = array();
$guidelines[] = VIEWS_SEND_MIMEMAIL ? t('Messages will be send in plain format.') : t('Only plain format is available. If you want to format the message as HTML, you\'ll have to install and enable <a href="http://drupal.org/project/mimemail">Mime Mail</a> module.');
if (!VIEWS_SEND_MIMEMAIL && _views_send_allow_php()) {
$guidelines[] = t('You may post PHP code. You should include <?php ?> tags.');
}
$guidelines = count($guidelines) == 1 ? '<p>' . $guidelines[0] . '</p>' : theme('item_list', $guidelines);
$form[VIEWS_SEND_FORMAT_PLAIN] = array(
'#type' => 'radio',
'#title' => t('Plain'),
'#default_value' => VIEWS_SEND_MIMEMAIL ? $default_value : VIEWS_SEND_FORMAT_PLAIN,
'#return_value' => VIEWS_SEND_FORMAT_PLAIN,
'#parents' => $parents,
'#description' => $guidelines,
'#id' => form_clean_id('edit-' . implode('-', array_merge($parents, array(
VIEWS_SEND_FORMAT_PLAIN,
)))),
);
// If Mime Mail module is not present we allow only plain format.
if (!VIEWS_SEND_MIMEMAIL) {
return $form;
}
$formats = filter_formats();
$extra = theme('filter_tips_more_info');
// Multiple formats available: display radio buttons with tips.
foreach ($formats as $fid => $format) {
// Generate the parents as the autogenerator does, so we will have a
// unique id for each radio button.
$parents_for_id = array_merge($parents, array(
$format->format,
));
$form[$format->format] = array(
'#type' => 'radio',
'#title' => $format->name,
'#default_value' => $default_value,
'#return_value' => $format->format,
'#parents' => $parents,
'#description' => theme('filter_tips', _filter_tips($format->format, FALSE)),
'#id' => form_clean_id('edit-' . implode('-', $parents_for_id)),
);
}
$form[] = array(
'#value' => $extra,
);
return $form;
}