Go to the source code of this file.
|
| base_with_data () |
| Example show how to create and render a basic tag input field and attach it to a form. More...
|
|
◆ base_with_data()
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_data.php.
7{
8
10 $ui =
$DIC->ui()->factory();
11 $renderer =
$DIC->ui()->renderer();
13
14
15 $multi_select_input = $ui->input()->field()->tag(
16 "Basic TagInput",
17 ['Interesting', 'Boring', 'Animating', 'Repetitious'],
18 "Just some tags"
19 );
20
21
22 $DIC->ctrl()->setParameterByClass(
23 ilSystemStyleDocumentationGUI::class,
24 'example_name',
25 'tag_inputs'
26 );
27 $DIC->ctrl()->saveParameterByClass(
28 ilSystemStyleDocumentationGUI::class,
29 'node_id'
30 );
31
32 $form_action =
$DIC->ctrl()->getFormActionByClass(ilSystemStyleDocumentationGUI::class);
33 $form = $ui->input()->container()->form()->standard($form_action, [$multi_select_input]);
34
35
36 if (
$request->getMethod() ===
"POST" &&
$request->getQueryParams()[
'example_name'] ===
'tag_inputs') {
39 } else {
41 }
42
43
44 return "<pre>" . print_r(
$result,
true) .
"</pre><br/>" . $renderer->render(
$form);
45}
foreach($paths as $path) $request
if(isset($_POST['submit'])) $form
References $DIC, $form, $request, and $result.