ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
base_with_value.php File Reference

Go to the source code of this file.

Functions

 base_with_value ()
 Example show how to create and render a basic tag input field and attach it to a form. More...
 

Function Documentation

◆ base_with_value()

base_with_value ( )

Example show how to create and render a basic tag input field and attach it to a form.

This example does not contain any data processing.

Definition at line 6 of file base_with_value.php.

References $DIC.

7 {
8  //Step 0: Declare dependencies
9  global $DIC;
10  $ui = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12 
13  //Step 1: Define the tag input field
14  $tag_input = $ui->input()->field()->tag(
15  "Basic TagInput",
16  ['Interesting', 'Boring', 'Animating', 'Repetitious'],
17  "Just some tags"
18  )->withValue(["Interesting"]);
19 
20  //Step 2, define form and form actions
21  $form = $ui->input()->container()->form()->standard("#", [$tag_input]);
22 
23  //Return the rendered form
24  return $renderer->render($form);
25 }
global $DIC
Definition: goto.php:24