Go to the source code of this file.
|
| base () |
| Base example showing how to plug a checkbox into a form. More...
|
|
◆ base()
Base example showing how to plug a checkbox into a form.
Definition at line 5 of file base.php.
6{
7
9 $ui =
$DIC->ui()->factory();
10 $renderer =
$DIC->ui()->renderer();
11 $request =
$DIC->http()->request();
12
13
14 $checkbox_input = $ui->input()->field()->checkbox("Checkbox", "Check or not.")
15 ->withValue(true);
16
17
18 $form = $ui->input()->container()->form()->standard('#', [ $checkbox_input]);
19
20
21
22 if ($request->getMethod() == "POST") {
23 $form = $form->withRequest($request);
25 } else {
27 }
28
29
30 return
31 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
32 $renderer->render($form);
33}
References $DIC, and $result.