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

Go to the source code of this file.

Functions

 base ()
 Example of how to create and render a file input field and attach it to a form. More...
 

Function Documentation

◆ base()

base ( )

Example of how to create and render a file input field and attach it to a form.

Definition at line 5 of file base.php.

References $DIC.

6 {
7  // Step 0: Declare dependencies.
8  global $DIC;
9  $ui = $DIC->ui()->factory();
10  $renderer = $DIC->ui()->renderer();
11 
12  // Step 1: Define the input field.
13  // See the implementation of a UploadHandler in Services/UI/classes/class.ilUIDemoFileUploadHandlerGUI.php
14  $file_input = $ui->input()->field()->file(new ilUIDemoFileUploadHandlerGUI(), "Upload File", "you can drop your files here");
15 
16  // Step 2: Define the form and attach the field.
17  $form = $ui->input()->container()->form()->standard("#", [$file_input]);
18 
19  // Step 4: Render the form.
20  return $renderer->render($form);
21 }
Class ilUIDemoFileUploadHandlerGUI.
global $DIC
Definition: goto.php:24