this.getOptions().forEach((option, i) => {
const input = document.createElement("input");
input.type = "hidden";
- input.name = `${this.wysiwygId}Poll_options[${i}]`;
+ input.name = `${this.wysiwygId}pollOptions[${i}]`;
input.value = option;
form.appendChild(input);
});
return {
[this.questionField.id]: this.questionField.value,
[this.wysiwygId + "Poll_options"]: this.getOptions(),
+ [this.wysiwygId + "pollOptions"]: this.getOptions(),
[this.endTimeField.id]: this.endTimeField.value,
[this.maxVotesField.id]: this.maxVotesField.value,
[this.isChangeableYesField.id]: !!this.isChangeableYesField.checked,
this.getOptions().forEach((option, i) => {
const input = document.createElement("input");
input.type = "hidden";
- input.name = `${this.wysiwygId}Poll_options[${i}]`;
+ input.name = `${this.wysiwygId}pollOptions[${i}]`;
input.value = option;
form.appendChild(input);
});
return {
[this.questionField.id]: this.questionField.value,
[this.wysiwygId + "Poll_options"]: this.getOptions(),
+ [this.wysiwygId + "pollOptions"]: this.getOptions(),
[this.endTimeField.id]: this.endTimeField.value,
[this.maxVotesField.id]: this.maxVotesField.value,
[this.isChangeableYesField.id]: !!this.isChangeableYesField.checked,
{
parent::populate();
- $id = $this->wysiwygId . 'Poll';
+ $id = $this->wysiwygId . 'poll';
// add data handler to group poll data into a sub-array of parameters
$this->getDocument()->getDataHandler()->addProcessor(new CustomFormDataProcessor(
$wysiwygId = $this->getWysiwygId();
foreach (self::FIELD_NAMES as $fieldName) {
- $parameters[$wysiwygId . '_pollData'][$fieldName] = $parameters['data'][$id . '_' . $fieldName];
- unset($parameters['data'][$id . '_' . $fieldName]);
+ $parameters[$wysiwygId . '_pollData'][$fieldName] = $parameters['data'][$id . \ucfirst($fieldName)];
+ unset($parameters['data'][$id . \ucfirst($fieldName)]);
}
// this will always add a poll array to the parameters but
}
));
- $this->questionField = TextFormField::create($id . '_question')
+ $this->questionField = TextFormField::create($id . 'Question')
->label('wcf.poll.question')
->maximumLength(255);
// if either options or question is given, the other must also be given
- $this->optionsField = PollOptionsFormField::create($id . '_options')
+ $this->optionsField = PollOptionsFormField::create($id . 'Options')
->wysiwygId($this->getWysiwygId())
->addValidator(new FormFieldValidator('empty', static function (PollOptionsFormField $formField) use ($id) {
/** @var TextFormField $questionFormField */
- $questionFormField = $formField->getDocument()->getNodeById($id . '_question');
+ $questionFormField = $formField->getDocument()->getNodeById($id . 'Question');
if (empty($formField->getValue()) && $questionFormField->getValue() !== '') {
$formField->addValidationError(new FormFieldValidationError('empty'));
}
}));
- $this->endTimeField = DateFormField::create($id . '_endTime')
+ $this->endTimeField = DateFormField::create($id . 'EndTime')
->label('wcf.poll.endTime')
->supportTime()
->addValidator(new FormFieldValidator('futureTime', function (DateFormField $formField) {
}
}));
- $this->maxVotesField = IntegerFormField::create($id . '_maxVotes')
+ $this->maxVotesField = IntegerFormField::create($id . 'MaxVotes')
->label('wcf.poll.maxVotes')
->minimum(1)
->maximum(POLL_MAX_OPTIONS)
->value(1);
- $this->isChangeableField = BooleanFormField::create($id . '_isChangeable')
+ $this->isChangeableField = BooleanFormField::create($id . 'IsChangeable')
->label('wcf.poll.isChangeable');
/** @var IPollHandler $pollHandler */
$pollHandler = $this->getObjectType()->getProcessor();
}
- $this->isPublicField = BooleanFormField::create($id . '_isPublic')
+ $this->isPublicField = BooleanFormField::create($id . 'IsPublic')
->label('wcf.poll.isPublic')
->available($pollHandler !== null && $pollHandler->canStartPublicPoll());
- $this->resultsRequireVoteField = BooleanFormField::create($id . '_resultsRequireVote')
+ $this->resultsRequireVoteField = BooleanFormField::create($id . 'ResultsRequireVote')
->label('wcf.poll.resultsRequireVote')
->description('wcf.poll.resultsRequireVote.description');
- $this->sortByVotesField = BooleanFormField::create($id . '_sortByVotes')
+ $this->sortByVotesField = BooleanFormField::create($id . 'SortByVotes')
->label('wcf.poll.sortByVotes');
$this->appendChildren([