function _poll_choice_form
Same name and namespace in other branches
- 6.x drupal-6.x/modules/poll/poll.module \_poll_choice_form()
1 call to _poll_choice_form()
- poll_form in drupal-7.x/modules/poll/poll.module
- Implements hook_form().
Archivo
- drupal-7.x/modules/poll/poll.module, line 381
- Enables your site to capture votes on different topics in the form of multiple
choice questions.
Código
function _poll_choice_form($key, $chid = NULL, $value = '', $votes = 0, $weight = 0, $size = 10) {
$form = array(
'#tree' => TRUE,
'#weight' => $weight,
);
$form['chid'] = array(
'#type' => 'value',
'#value' => $chid,
'#parents' => array('choice', $key, 'chid'),
);
$form['chtext'] = array(
'#type' => 'textfield',
'#title' => $value !== '' ? t('Choice label') : t('New choice label'),
'#title_display' => 'invisible',
'#default_value' => $value,
'#parents' => array('choice', $key, 'chtext'),
);
$form['chvotes'] = array(
'#type' => 'textfield',
'#title' => $value !== '' ? t('Vote count for choice @label', array('@label' => $value)) : t('Vote count for new choice'),
'#title_display' => 'invisible',
'#default_value' => $votes,
'#size' => 5,
'#maxlength' => 7,
'#parents' => array('choice', $key, 'chvotes'),
'#access' => user_access('administer nodes'),
'#element_validate' => array('element_validate_integer'),
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => $value !== '' ? t('Weight for choice @label', array('@label' => $value)) : t('Weight for new choice'),
'#title_display' => 'invisible',
'#default_value' => $weight,
'#delta' => $size,
'#parents' => array('choice', $key, 'weight'),
);
return $form;
}