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 
18 function with_error()
19 {
20  //Step 0: Declare dependencies
21  global $DIC;
22  $ui = $DIC->ui()->factory();
23  $renderer = $DIC->ui()->renderer();
24 
25  //Step 1: Define the URL input field
26  $url_input = $ui->input()->field()->url("Basic Input", "Just some basic input with
27  some error attached.")
28  ->withError("Some error");
29 
30  //Step 2: Define the form and attach the section
31  $form = $ui->input()->container()->form()->standard("#", [$url_input]);
32 
33  //Step 4: Render the form with the URL input field
34  return $renderer->render($form);
35 }
$renderer
global $DIC
Definition: shib_login.php:25
with_error()
description: > This example shows how to create and render a basic URL input field with an error and...
Definition: with_error.php:18