ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
with_error.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
35 function with_error()
36 {
37  //Declare dependencies
38  global $DIC;
39  $ui = $DIC->ui()->factory();
40  $renderer = $DIC->ui()->renderer();
41 
42  //Define the text input field
43  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input
44  with some error attached.")
45  ->withError("Some error");
46 
47  //Define the form and attach the section.
48  $form = $ui->input()->container()->form()->standard("#", [$text_input]);
49 
50  //Render the form with the text input field
51  return $renderer->render($form);
52 }
$renderer
with_error()
description: > Example shows how to create and render a basic text input field with an error attache...
Definition: with_error.php:35
global $DIC
Definition: shib_login.php:26