ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
with_error.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
11 function with_error()
12 {
13  //Step 0: Declare dependencies
14  global $DIC;
15  $ui = $DIC->ui()->factory();
16  $renderer = $DIC->ui()->renderer();
17 
18  //Step 1: Define the text input field
19  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input
20  with some error attached.")
21  ->withError("Some error");
22 
23  //Step 2: Define the form and attach the section.
24  $form = $ui->input()->container()->form()->standard("#", [$text_input]);
25 
26  //Step 4: Render the form with the text input field
27  return $renderer->render($form);
28 }
with_error()
Example show how to create and render a basic text input field with an error attached to it...
Definition: with_error.php:11
global $DIC
Definition: feed.php:28