ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
in_form.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
27 function in_form()
28 {
29  //Step 0: Declare dependencies
30  global $DIC;
31  $ui = $DIC->ui()->factory();
32  $renderer = $DIC->ui()->renderer();
33  $request = $DIC->http()->request();
34 
35  //Step 1: Define the input field.
36  $pwd_input = $ui->input()->field()->password("Password", "Value will be displayed...")
37  ->withRevelation(true);
38 
39  //Step 2: Define the form and attach the field.
40  $form = $ui->input()->container()->form()->standard('#', ['password' => $pwd_input]);
41 
42  //Step 3: Define some data processing.
43  $result = '';
44  if ($request->getMethod() == "POST") {
45  $form = $form->withRequest($request);
46  $result = $form->getData();
47  }
48 
49  //Step 4: Render the form/result.
50  return
51  "<pre>" . print_r($result, true) . "</pre><br/>" .
52  $renderer->render($form);
53 }
$renderer
in_form()
description: > Example of how to process passwords.
Definition: in_form.php:27
global $DIC
Definition: shib_login.php:25