ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
18 function base()
19 {
20  //Step 0: Declare dependencies
21  global $DIC;
22  $ui = $DIC->ui()->factory();
23  $renderer = $DIC->ui()->renderer();
24 
25  //Step 1: Define some input field to plug into the form.
26  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input");
27 
28  //Step 2: Define some section carrying a title and description with the previously
29  //defined input
30  $section1 = $ui->input()->field()->section([$text_input], "Section 1", "Description of Section 1");
31 
32  //Step 3: Define the form action to target the input processing
33  $DIC->ctrl()->setParameterByClass(
34  'ilsystemstyledocumentationgui',
35  'example_name',
36  'base'
37  );
38  $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
39 
40  //Step 4: Define the form and attach the section.
41  $form = $ui->input()->container()->form()->standard($form_action, [$section1]);
42 
43  //Step 5: Render the form
44  return $renderer->render($form);
45 }
$renderer
base()
description: > Examples showing how to create and render a basic form with one input.
Definition: base.php:18
global $DIC
Definition: shib_login.php:25