ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
base.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
39function base()
40{
41 //Step 0: Declare dependencies
42 global $DIC;
43 $ui = $DIC->ui()->factory();
44 $request = $DIC->http()->request();
45 $renderer = $DIC->ui()->renderer();
46
47 //Step 1: Define the textarea input field
48 $textarea_input = $ui->input()->field()->textarea("Textarea Input", "Just a textarea input.");
49
50 //Step 2: Define the form action to target the input processing
51 $DIC->ctrl()->setParameterByClass(
52 'ilsystemstyledocumentationgui',
53 'example_name',
54 'base'
55 );
56 $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
57
58 //Step 3: Define the form and form actions.
59 $form = $ui->input()->container()->form()->standard($form_action, [$textarea_input]);
60
61 //Step 4: Define some data processing.
62 if ($request->getMethod() == "POST" && $request->getQueryParams()['example_name'] == 'base') {
63 $form = $form->withRequest($request);
64 $result = $form->getData();
65 } else {
66 $result = "No result yet.";
67 }
68
69 //Step 5: Render the form with the text input field
70 return
71 "<pre>" . print_r($result, true) . "</pre><br/>" .
72 $renderer->render($form);
73}
$renderer
global $DIC
Definition: shib_login.php:26