_poll_choice_form

Versions
6
_poll_choice_form($delta, $value = '', $votes = 0)
7
_poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight = 0, $size = 10)

Code

modules/poll/poll.module, line 342

<?php
function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight = 0, $size = 10) {
  $admin = user_access('administer nodes');

  $form = array(
    '#tree' => TRUE,
  );

  // We'll manually set the #parents property of these fields so that
  // their values appear in the $form_state['values']['choice'] array.
  $form['chid'] = array(
    '#type' => 'value',
    '#value' => $chid,
    '#parents' => array('choice', $key, 'chid'),
  );

  $form['chtext'] = array(
    '#type' => 'textfield',
    '#default_value' => $value,
    '#parents' => array('choice', $key, 'chtext'),
  );

  $form['chvotes'] = array(
    '#type' => 'textfield',
    '#default_value' => $votes,
    '#size' => 5,
    '#maxlength' => 7,
    '#parents' => array('choice', $key, 'chvotes'),
    '#access' => user_access('administer nodes'),
  );

  $form['weight'] = array(
    '#type' => 'weight',
    '#default_value' => $weight,
    '#delta' => $size,
    '#parents' => array('choice', $key, 'weight'),
  );

  return $form;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.