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