10 $ui = $DIC->ui()->factory();
11 $lng = $DIC->language();
12 $renderer = $DIC->ui()->renderer();
13 $request = $DIC->http()->request();
14 $data = new \ILIAS\Data\Factory();
15 $refinery = new \ILIAS\Refinery\Factory(
$data,
$lng);
18 $sum = $refinery->custom()->transformation(
function ($vs) {
23 $equal_ten = $refinery->custom()->constraint(
function ($v) {
25 },
"The sum must equal ten");
28 $number_input = $ui->input()->field()->numeric(
"number",
"Put in a number.")->withValue(5);
32 $group = $ui->input()->field()->section(
33 [ $number_input->withLabel(
"Left"), $number_input->withLabel(
"Right")],
35 "Left and Right must equal 10" 37 ->withAdditionalTransformation($sum)
38 ->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);
disabled()
Example showing how to plug a disabled checkbox into a form.