ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
with_value.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
23 
39 function with_value(): string
40 {
41  global $DIC;
42 
43  $factory = $DIC->ui()->factory();
44  $renderer = $DIC->ui()->renderer();
45 
46  $input = $factory->input()->field()->image(
48  ImagePurpose::USER_DEFINED,
49  'Upload Image',
50  'Please provide an alternate text if necessary.',
51  $factory->input()->field()->text('Additional information')
52  )->withMaxFiles(2);
53 
54  $input = $input->withValue([
55  [
56  'file_id_1',
57  [
58  [ImagePurpose::INFORMATIVE->name, ['alternate text']],
59  'additional metadata',
60  ],
61  ],
62  [
63  'file_id_2',
64  [
65  ImagePurpose::DECORATIVE->name,
66  'additional metadata',
67  ],
68  ],
69  ]);
70 
71  $form = $factory->input()->container()->form()->standard("#", [$input]);
72 
73  return $renderer->render($form);
74 }
$renderer
ImagePurpose
This enum provides options to categorise the purpose of an image, which will be used to determine whe...
Class ilUIDemoFileUploadHandlerGUI.
global $DIC
Definition: shib_login.php:26
with_value()
description: > The example shows how to create and render a Image Field with existing values and att...
Definition: with_value.php:39