Elgg  Version master
default.php
Go to the documentation of this file.
1 <?php
9 $entity = elgg_extract('entity', $vars);
10 if (!$entity instanceof ElggEntity) {
11  return;
12 }
13 
14 $input_name = elgg_extract('input_name', $vars);
15 if (empty($input_name)) {
16  return;
17 }
18 
20 $delete_icon = elgg_view_icon('delete', ['class' => 'elgg-autocomplete-item-remove']);
21 
22 $body = elgg_view_image_block($icon, $entity->getDisplayName(), ['image_alt' => $delete_icon]);
23 $body .= elgg_view('input/hidden', [
24  'name' => "{$input_name}[]",
25  'value' => $entity->guid,
26 ]);
27 
28 echo elgg_format_element('li', [
29  'class' => 'elgg-item',
30  'data-guid' => $entity->guid,
31 ], $body);
elgg_view_image_block(string $image, string $body, array $vars=[])
Wrapper function for the image block display pattern.
Definition: views.php:919
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_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
elgg_view_entity_icon(\ElggEntity $entity, string $size= 'medium', array $vars=[])
View the icon of an entity.
Definition: views.php:563
if(!$entity instanceof ElggEntity) $input_name
Definition: default.php:14
$body
Definition: default.php:22
$delete_icon
Definition: default.php:20
if(!array_key_exists($size, $icon_sizes)) $vars['size']
Definition: default.php:25
elgg_view_icon(string $name, array $vars=[])
View an icon glyph.
Definition: views.php:1282
$entity
Generic icon view.
Definition: default.php:13
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
if($user->isBanned()) elseif($user->isValidated()===false) $icon
Definition: default.php:46