Elgg  Version master
file.php
Go to the documentation of this file.
1 <?php
9 $icon_type = elgg_extract('icon_type', $vars, 'icon');
10 if (elgg_language_key_exists("entity:edit:{$icon_type}:file:label")) {
11  $label = elgg_echo("entity:edit:{$icon_type}:file:label");
12 } else {
13  $label = elgg_echo('entity:edit:icon:file:label');
14 }
15 
16 if (elgg_language_key_exists("entity:edit:{$icon_type}:file:help")) {
17  $help = elgg_echo("entity:edit:{$icon_type}:file:help");
18 } else {
19  $help = elgg_echo('entity:edit:icon:file:help');
20 }
21 
22 echo elgg_view_field([
23  '#type' => 'file',
24  '#label' => $label,
25  '#help' => $help,
26  '#class' => 'elgg-entity-edit-icon-file',
27  'name' => elgg_extract('name', $vars, 'icon'),
28  'accept' => 'image/*',
29  'required' => (bool) elgg_extract('required', $vars, false),
30 ]);
if($view &&elgg_view_exists($view)) $label
Definition: field.php:26
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
$icon_type
Input for new icon upload.
Definition: file.php:9
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
Definition: languages.php:44
$help
Definition: field.php:27
if(!empty($vars['value'])) $vars['class']
Elgg file input Displays a file input field.
Definition: file.php:19