function advpoll_preprocess_advpoll_voting_ranking_form in Advanced Poll 6.3
Same name and namespace in other branches
- 6 modes/ranking.inc \advpoll_preprocess_advpoll_voting_ranking_form()
- 6.2 modes/ranking.inc \advpoll_preprocess_advpoll_voting_ranking_form()
Process variables for advpoll-display-ranking-form.tpl.php.
The variables array contains the following arguments:
- $form
See also
advpoll-display-ranking-form.tpl.php
File
- modes/
ranking.inc, line 184 - Handle ranking votes, e.g. choice A is preferred over choice B, which in turn is preferred over choice C.
Code
function advpoll_preprocess_advpoll_voting_ranking_form(&$variables) {
$form =& $variables['form'];
$variables['message'] = drupal_render($form['message']);
// If write-ins are used on this form.
if (isset($form['writein_choice'])) {
$variables['writein_choice'] = drupal_render($form['writein_choice']);
}
$variables['footer_message'] = $form['#node']->footer_message;
$variables['form_id'] = $form['#id'];
// List of available choices in the poll.
$variables['choice_list'] = drupal_render($form['choice']);
// Take off the annoying colon & endlines that Drupal adds to each title.
$variables['choice_list'] = preg_replace('/[\\n\\r]*: <\\/label>[\\n\\r]*/i', '</label>', $variables['choice_list']);
// All remaining form elements.
$variables['form_submit'] = drupal_render($form);
// Add tabledrag JavaScript.
drupal_add_tabledrag($form['#id'] . '-table', 'order', 'self', 'advpoll-choice-order', NULL, NULL, FALSE);
}