3 declare(strict_types=1);
16 $ui = $DIC->ui()->factory();
17 $lng = $DIC->language();
18 $renderer = $DIC->ui()->renderer();
19 $request = $DIC->http()->request();
20 $data = new \ILIAS\Data\Factory();
24 $sum =
$refinery->custom()->transformation(
function ($vs) {
29 $equal_ten =
$refinery->custom()->constraint(
function ($v) {
31 },
"The sum must equal ten.");
34 $number_input = $ui->input()->field()->numeric(
"number",
"Put in a number.");
38 $group = $ui->input()->field()->group(
39 [ $number_input->withLabel(
"Left"), $number_input->withLabel(
"Right")]
42 ->withAdditionalTransformation($equal_ten);
45 $form = $ui->input()->container()->form()->standard(
'#', [
"custom_group" => $group]);
48 if ($request->getMethod() ==
"POST") {
51 $form = $form->withRequest($request);
52 $group = $form->getInputs()[
"custom_group"];
53 if ($group->getError()) {
54 $result = $group->getError();
57 $result = $form->getData();
60 $result =
"No result yet.";
65 "<pre>" . print_r($result,
true) .
"</pre><br/>" .
66 $renderer->render($form);
Refinery Factory $refinery