Go to the source code of this file.
◆ with_dependant_group()
Example showing how a dependant group (aka sub form) might be attached to a checkbox.
Definition at line 5 of file with_dependant_group.php.
6{
7
9 $ui =
$DIC->ui()->factory();
10 $renderer =
$DIC->ui()->renderer();
12
13
14 $dependant_field = $ui->input()->field()->text("Item 1", "Just some dependent group field");
15 $dependant_group = $ui->input()->field()->dependantGroup(["dependant_field" => $dependant_field]);
16
17
18 $checkbox_input = $ui->input()->field()->checkbox("Checkbox", "Check to display dependant field.")
19 ->withDependantGroup($dependant_group);
20
21
22 $DIC->ctrl()->setParameterByClass(
23 'ilsystemstyledocumentationgui',
24 'example_name',
25 'dependant_checkbox'
26 );
27 $form_action =
$DIC->ctrl()->getFormActionByClass(
'ilsystemstyledocumentationgui');
28 $form = $ui->input()->container()->form()->standard($form_action, [ $checkbox_input]);
29
30
31
33 &&
$request->getQueryParams()[
'example_name'] ==
'dependant_checkbox') {
36 } else {
38 }
39
40
41 return
42 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
43 $renderer->render(
$form);
44}
foreach($paths as $path) $request
if(isset($_POST['submit'])) $form
References $DIC, $form, $request, and $result.