ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
in_form.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
42 function in_form()
43 {
44  // Step 0: Declare dependencies
45  global $DIC;
46  $ui = $DIC->ui()->factory();
47  $renderer = $DIC->ui()->renderer();
48  $request = $DIC->http()->request();
49 
50  // Step 1: Define the input field.
51  // See the implementation of a UploadHandler in components/ILIAS/UI_/classes/class.ilUIDemoFileUploadHandlerGUI.php
52  $file = $ui->input()->field()->file(new \ilUIDemoFileUploadHandlerGUI(), "File Upload", "You can drop your files here");
53 
54  // Step 2: Define the form and attach the field.
55  $form = $ui->input()->container()->form()->standard('#', ['file' => $file]);
56 
57  // Step 3: Define some data processing.
58  $result = '';
59  if ($request->getMethod() == "POST") {
60  $form = $form->withRequest($request);
61  $result = $form->getData();
62  }
63 
64  // Step 4: Render the form/result.
65  return
66  "<pre>" . print_r($result, true) . "</pre><br/>" .
67  $renderer->render($form);
68 }
$renderer
in_form()
description: > Example of how to process passwords.
Definition: in_form.php:42
Class ilUIDemoFileUploadHandlerGUI.
global $DIC
Definition: shib_login.php:22