ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
in_form.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
43function in_form()
44{
45 //Step 0: Declare dependencies
46 global $DIC;
47 $ui = $DIC->ui()->factory();
48 $renderer = $DIC->ui()->renderer();
49 $request = $DIC->http()->request();
50
51 //Step 1: Define the input field.
52 $pwd_input = $ui->input()->field()->password("Password", "Value will be displayed...")
53 ->withRevelation(true);
54
55 //Step 2: Define the form and attach the field.
56 $form = $ui->input()->container()->form()->standard('#', ['password' => $pwd_input]);
57
58 //Step 3: Define some data processing.
59 $result = '';
60 if ($request->getMethod() == "POST") {
61 $form = $form->withRequest($request);
62 $result = $form->getData();
63 }
64
65 //Step 4: Render the form/result.
66 return
67 "<pre>" . print_r($result, true) . "</pre><br/>" .
68 $renderer->render($form);
69}
$renderer
global $DIC
Definition: shib_login.php:26