ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
base.php
Go to the documentation of this file.
1 <?php
6 function base()
7 {
8  //Step 0: Declare dependencies
9  global $DIC;
10  $ui = $DIC->ui()->factory();
11  $request = $DIC->http()->request();
12  $renderer = $DIC->ui()->renderer();
13 
14  //Step 1: Define the textarea input field
15  $textarea_input = $ui->input()->field()->textarea("Textarea Input", "Just a textarea input.");
16 
17  //Step 2: Define the form action to target the input processing
18  $DIC->ctrl()->setParameterByClass(
19  'ilsystemstyledocumentationgui',
20  'example_name',
21  'base'
22  );
23  $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
24 
25  //Step 3: Define the form and form actions.
26  $form = $ui->input()->container()->form()->standard($form_action, [$textarea_input]);
27 
28  //Step 4: Define some data processing.
29  if ($request->getMethod() == "POST" && $request->getQueryParams()['example_name'] == 'base') {
30  $form = $form->withRequest($request);
31  $result = $form->getData();
32  } else {
33  $result = "No result yet.";
34  }
35 
36  //Step 5: Render the form with the text input field
37  return
38  "<pre>" . print_r($result, true) . "</pre><br/>" .
39  $renderer->render($form);
40 }
$result
base()
Definition: base.php:4
global $DIC
Definition: goto.php:24