Elgg  Version 6.1
default.php
Go to the documentation of this file.
1 <?php
2 
3 $entity = elgg_extract('entity', $vars);
4 if (!$entity instanceof \ElggGroup) {
5  return;
6 }
7 
8 $input_name = elgg_extract('input_name', $vars);
9 
10 // reset the viewtype so we can render html views
12 elgg_set_viewtype('default');
13 
15  'use_link' => false,
16  'href' => false,
17 ]);
18 
19 $label = elgg_view_image_block($icon, $entity->getDisplayName(), ['class' => 'elgg-autocomplete-item']);
20 
21 $data = $entity->toObject();
22 $data->label = $label;
23 $data->value = $entity->guid;
24 $data->icon = $icon;
25 
27  $data->html = elgg_view('input/autocomplete/item', $vars);
28 }
29 
30 echo json_encode($data);
31 
32 // restore viewtype
elgg_view_image_block(string $image, string $body, array $vars=[])
Wrapper function for the image block display pattern.
Definition: views.php:898
$data
Definition: default.php:21
elgg_get_viewtype()
Return the current view type.
Definition: views.php:73
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:256
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
elgg_view_entity_icon(\ElggEntity $entity, string $size= 'medium', array $vars=[])
View the icon of an entity.
Definition: views.php:542
if(!$entity instanceof ElggEntity) $input_name
Definition: default.php:14
elgg_set_viewtype(string $viewtype= '')
Manually set the viewtype.
Definition: views.php:60
$viewtype
Definition: default.php:11
if(!array_key_exists($size, $icon_sizes)) $vars['size']
Definition: default.php:25
$entity
Generic icon view.
Definition: default.php:13
$label
Definition: default.php:19
if($user->isBanned()) elseif($user->isValidated()===false) $icon
Definition: default.php:46