Ist es möglich, über ChoiceType-Werte in Symfony 3 zu iterieren? Ich kann die Werte gut einstellen, aber sie geben nur in großen Blöcken aus, die ich nicht kontrollieren kann. Ich möchte über jeden Wert in einer Schleife und formatieren/put in der Tabelle/div/Spalten usw.So formatieren/steuern Sie die Ausgabe von Symfony ChoiceType
$builder->add('tOptions', ChoiceType::class, array(
'choices' => array(
'one' => true,
'two' => true,
'three' => true,
'four' => true,
'five' => true,
),
'expanded' => true,
'multiple' => true,
'required' => false,
));
Hinweis: Ich bin nicht in Zweig, nur in PHP ausgibt.
echo $view['form']->widget($form['tOptions']);
Ergebnisse in:
<div id="t_options_tOptions">
<input type="checkbox" id="t_options_tOptions_0" name="t_options[tOptions][]" value="0">
<label for="t_options_tOptions_0">one</label>
<input type="checkbox" id="t_options_tOptions_1" name="t_options[tOptions][]" value="1">
<label for="t_options_tOptions_1">two</label>
<input type="checkbox" id="t_options_tOptions_2" name="t_options[tOptions][]" value="2">
<label for="t_options_tOptions_2">three</label>
<input type="checkbox" id="t_options_tOptions_3" name="t_options[tOptions][]" value="3">
<label for="t_options_tOptions_3">four</label>
<input type="checkbox" id="t_options_tOptions_4" name="t_options[tOptions][]" value="4">
<label for="t_options_tOptions_4">five</label>
</div>
Wie funktioniert ein Iterierte über diese Eingabemöglichkeiten, um jeweils in div oder aufgeteilt in zwei geraden Spalten zu wickeln usw.
danke. Bin endlich da. In diesem Fall war es die Datei choice_widget_expanded. – BrocolliRob