ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
34 function base()
35 {
36  //Step 0: Declare dependencies
37  global $DIC;
38  $ui = $DIC->ui()->factory();
39  $renderer = $DIC->ui()->renderer();
40 
41  //Step 1: Define some input field to plug into the form.
42  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input");
43 
44  //Step 2: Define some section carrying a title and description with the previously
45  //defined input
46  $section1 = $ui->input()->field()->section([$text_input], "Section 1", "Description of Section 1");
47 
48  //Step 3: Define the form action to target the input processing
49  $DIC->ctrl()->setParameterByClass(
50  'ilsystemstyledocumentationgui',
51  'example_name',
52  'base'
53  );
54  $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
55 
56  //Step 4: Define the form and attach the section.
57  $form = $ui->input()->container()->form()->standard($form_action, [$section1]);
58 
59  //Step 5: Render the form
60  return $renderer->render($form);
61 }
$renderer
base()
description: > Examples showing how to create and render a basic form with one input.
Definition: base.php:34
global $DIC
Definition: shib_login.php:22