19 declare(strict_types=1);
74 $ui = $DIC->ui()->factory();
76 $request = $DIC->http()->request();
77 $data = new \ILIAS\Data\Factory();
80 $group1 = $ui->input()->field()->group(
82 "field_1_1" => $ui->input()->field()->text(
"Item 1.1",
"Just some field"),
83 "field_1_2" => $ui->input()->field()->text(
"Item 1.2",
"Just some other field"),
84 "field_1_3" => $ui->input()->field()->datetime(
"Item 1.3",
"a date")->withFormat(
$data->dateFormat()->germanShort())
86 "Switchable Group number one (with numeric key)" 88 $group2 = $ui->input()->field()->group(
90 "field_2_1" => $ui->input()->field()->text(
"Item 2",
"Just another field")
91 ->withValue(
'some val')
93 "Switchable Group number two",
96 $group3 = $ui->input()->field()->group([],
'No items in this group',
'but a byline');
99 $sg = $ui->input()->field()->switchableGroup(
109 $form = $ui->input()->container()->form()->standard(
112 'switchable_group' => $sg,
113 'switchable_group_required' => $sg->withRequired(
true),
114 'switchable_group_preset' => $sg->withValue(
"g2")
115 ->withLabel(
"Again, Pick One")
116 ->withByline(
"... or the other. 117 Second option is selected by default here.")
122 if ($request->getMethod() ==
"POST") {
123 $form = $form->withRequest($request);
124 $result = $form->getData();
126 $result =
"No result yet.";
131 "<pre>" . htmlspecialchars(print_r($result,
true), ENT_QUOTES) .
"</pre><br/>" .