protected function ApprovalPollViewForm::getWriteInOptions in Advanced Poll 8
Get list of non-empty write-in options.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state:
Return value
array
2 calls to ApprovalPollViewForm::getWriteInOptions()
- ApprovalPollViewForm::save in src/
Form/ ApprovalPollViewForm.php - Save a user's vote submit function.
- ApprovalPollViewForm::validateVote in src/
Form/ ApprovalPollViewForm.php - Validates the vote action.
File
- src/
Form/ ApprovalPollViewForm.php, line 351
Class
- ApprovalPollViewForm
- Class ApprovalPollViewForm
Namespace
Drupal\advpoll\FormCode
protected function getWriteInOptions(FormStateInterface $form_state) {
$numWriteIn = $form_state
->get('num_writein');
$writeInOptions = [];
for ($i = 0; $i < $numWriteIn; $i++) {
$value = trim($form_state
->getValue('write_in_' . $i));
if ($value) {
$writeInOptions[] = $value;
}
}
return $writeInOptions;
}