You are here

function advpoll_writein_merge_form in Advanced Poll 6

Same name and namespace in other branches
  1. 5 advpoll.module \advpoll_writein_merge_form()
  2. 6.3 advpoll.module \advpoll_writein_merge_form()
  3. 6.2 advpoll.module \advpoll_writein_merge_form()
1 string reference to 'advpoll_writein_merge_form'
advpoll_writeins_page in ./advpoll.pages.inc

File

./advpoll.module, line 1466
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function advpoll_writein_merge_form(&$form_state, $node) {
  $form = array();
  $form['fieldset'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#title' => t('Merge write-ins'),
  );
  $form['fieldset']['note'] = array(
    '#value' => '<div class="description">' . t('This will delete the write-in and change any votes for it into votes for the selected chocie.') . '</div>',
  );
  $form['fieldset']['merge'] = array(
    '#prefix' => '<div class="container-inline">' . t('Merge') . ' ',
    '#suffix' => '</div>',
  );
  $writein_list = array();
  $choice_list = array();
  foreach ($node->choice as $index => $choice) {
    $choice_list[$index] = $choice['label'];
    if ($choice['writein']) {
      $writein_list[$index] = $choice['label'];
    }
  }
  $form['fieldset']['merge']['source'] = array(
    '#type' => 'select',
    '#options' => $writein_list,
  );
  $form['fieldset']['merge']['into'] = array(
    '#value' => t(' into '),
  );
  $form['fieldset']['merge']['destination'] = array(
    '#type' => 'select',
    '#options' => $choice_list,
  );
  $form['fieldset']['merge']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Merge'),
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $form['#node'] = $node;
  return $form;
}