ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
in_form.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
11 function in_form()
12 {
13  //Step 0: Declare dependencies
14  global $DIC;
15  $ui = $DIC->ui()->factory();
16  $renderer = $DIC->ui()->renderer();
17  $request = $DIC->http()->request();
18 
19  //Step 1: Define the input field.
20  $pwd_input = $ui->input()->field()->password("Password", "Value will be displayed...")
21  ->withRevelation(true);
22 
23  //Step 2: Define the form and attach the field.
24  $form = $ui->input()->container()->form()->standard('#', ['password' => $pwd_input]);
25 
26  //Step 3: Define some data processing.
27  $result = '';
28  if ($request->getMethod() == "POST") {
29  $form = $form->withRequest($request);
30  $result = $form->getData();
31  }
32 
33  //Step 4: Render the form/result.
34  return
35  "<pre>" . print_r($result, true) . "</pre><br/>" .
36  $renderer->render($form);
37 }
in_form()
Example of how to process passwords.
Definition: in_form.php:11
global $DIC
Definition: feed.php:28