ILIAS  release_8 Revision v8.23
base_with_value.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
11 function base_with_value()
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 tag input field
19  $tag_input = $ui->input()->field()->tag(
20  "Basic TagInput",
21  ['Interesting', 'Boring', 'Animating', 'Repetitious'],
22  "Just some tags"
23  )->withValue(["Interesting"]);
24 
25  //Step 2, define form and form actions
26  $form = $ui->input()->container()->form()->standard("#", [$tag_input]);
27 
28  //Return the rendered form
29  return $renderer->render($form);
30 }
base_with_value()
Example show how to create and render a basic tag input field and attach it to a form.
global $DIC
Definition: feed.php:28