summaryrefslogtreecommitdiff
path: root/modules/poll/poll.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-02-21 08:44:15 +0000
committerDries Buytaert <dries@buytaert.net>2006-02-21 08:44:15 +0000
commit9d162755c777249ea73c990804b74a1dfecff2ea (patch)
treea6f949615b82127a917b6699ed7fb13c377207f6 /modules/poll/poll.module
parentcf5475a7e15529bd09659ad0577b83e70df52dbc (diff)
downloadbrdo-9d162755c777249ea73c990804b74a1dfecff2ea.tar.gz
brdo-9d162755c777249ea73c990804b74a1dfecff2ea.tar.bz2
- Patch #50045 by merlinofchaos: fixed previews getting lost.
Diffstat (limited to 'modules/poll/poll.module')
-rw-r--r--modules/poll/poll.module10
1 files changed, 4 insertions, 6 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 8c6f6be55..d2e62de64 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -133,19 +133,17 @@ function poll_form(&$node) {
$form['title'] = array('#type' => 'textfield', '#title' => t('Question'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -1);
- if (!isset($node->choices)) {
- $node->choices = max(2, count($node->choice) ? count($node->choice) : 5);
- }
-
- $form['choice']['choices'] = array('#type' => 'hidden', '#default_value' => $node->choices);
+ $form['choice']['choices'] = array('#type' => 'hidden', '#default_value' => max(2, count($node->choice) ? count($node->choice) : 5));
$form['choice']['morechoices'] = array('#type' => 'checkbox', '#title' => t('Need more choices'), '#default_value' => 0, '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."), '#weight' => 1);
$form['choice'] = form_builder('poll_node_form', $form['choice']);
if ($form['choice']['morechoices']['#value']) {
$form['choice']['morechoices']['#value'] = 0;
$form['choice']['choices']['#value'] *= 2;
- $node->choices = $form['choice']['choices']['#value'];
}
+ // if the value was changed in a previous iteration, retain it.
+ $node->choices = $form['choice']['choices']['#value'];
+
// Poll choices
$form['choice'] += array('#type' => 'fieldset', '#title' => t('Choices'), '#prefix' => '<div class="poll-form">', '#suffix' => '</div>', '#tree' => TRUE);
for ($a = 0; $a < $node->choices; $a++) {