ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
with_error.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
19 function with_error()
20 {
21  //Declare dependencies
22  global $DIC;
23  $ui = $DIC->ui()->factory();
24  $renderer = $DIC->ui()->renderer();
25 
26  //Define the text input field
27  $text_input = $ui->input()->field()->text("Basic Input", "Just some basic input
28  with some error attached.")
29  ->withError("Some error");
30 
31  //Define the form and attach the section.
32  $form = $ui->input()->container()->form()->standard("#", [$text_input]);
33 
34  //Render the form with the text input field
35  return $renderer->render($form);
36 }
$renderer
with_error()
description: > Example shows how to create and render a basic text input field with an error attache...
Definition: with_error.php:19
global $DIC
Definition: shib_login.php:25