Skip to content

Commit

Permalink
Enum titles
Browse files Browse the repository at this point in the history
  • Loading branch information
nacmartin committed Mar 30, 2016
1 parent 2175135 commit 90520a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Limenius/Liform/Transformer/ChoiceTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ public function transform(FormInterface $form)
$formView = $form->createView();

$choices = [];
$titles = [];
foreach ($formView->vars['choices'] as $choiceView) {
if ($choiceView instanceof ChoiceGroupView) {
foreach ($choiceView->choices as $choiceItem) {
$choices[] = $choiceItem->value;
$titles[] = $choiceItem->label;
}
} else {
$choices[] = $choiceView->value;
$titles[] = $choiceView->label;
}
}
return [
'enum' => $choices,
'options' => ['enum_titles' => $titles],
'type' => 'string'
];

Expand Down

0 comments on commit 90520a8

Please sign in to comment.