Generates POST values for the poll node form, specifically poll choices.
$title: The title for the poll node.
$choices: An array containing poll choices, as generated by PollTestBase::_generateChoices().
$index: (optional) The amount/number of already submitted poll choices. Defaults to 0.
An indexed array containing:
function _pollGenerateEdit($title, array $choices, $index = 0) {
$max_new_choices = $index == 0 ? 2 : 1;
$already_submitted_choices = array_slice($choices, 0, $index);
$new_choices = array_values(array_slice($choices, $index, $max_new_choices));
$edit = array(
'title' => $title,
);
foreach ($already_submitted_choices as $k => $text) {
$edit['choice[chid:' . $k . '][chtext]'] = $text;
}
foreach ($new_choices as $k => $text) {
$edit['choice[new:' . $k . '][chtext]'] = $text;
}
return array(
$edit,
count($already_submitted_choices) + count($new_choices),
);
}