11 $ui = $DIC->ui()->factory();
12 $lng = $DIC->language();
13 $renderer = $DIC->ui()->renderer();
14 $request = $DIC->http()->request();
15 $data = new \ILIAS\Data\Factory();
16 $refinery = new \ILIAS\Refinery\Factory(
$data,
$lng);
19 $sum = $refinery->custom()->transformation(
function ($vs) {
24 $equal_ten = $refinery->custom()->constraint(
function ($v) {
26 },
"The sum must equal ten");
29 $number_input = $ui->input()->field()->numeric(
"number",
"Put in a number.");
33 $group = $ui->input()->field()->section(
34 [ $number_input->withLabel(
"Left"), $number_input->withLabel(
"Right")],
36 "Left and Right must equal 10" 38 ->withAdditionalTransformation($sum)
39 ->withAdditionalTransformation($equal_ten);
42 $form = $ui->input()->container()->form()->standard(
'#', [$group]);
45 if ($request->getMethod() ==
"POST") {
46 $form = $form->withRequest($request);
54 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
55 $renderer->render($form);