Elgg  Version 3.0
default.php
Go to the documentation of this file.
1 <?php
2 
3 $entity = elgg_extract('entity', $vars);
4 if (!$entity instanceof ElggUser) {
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  'use_hover' => false,
18 ]);
19 
20 $title = elgg_format_element('h3', [], $entity->getDisplayName());
21 
23  'class' => 'elgg-autocomplete-item',
24 ]);
25 
26 $data = $entity->toObject();
27 $data->label = $label;
28 $data->value = $entity->username;
29 $data->icon = $icon;
30 
32  $data->html = elgg_view('input/autocomplete/item', $vars);
33 }
34 
35 echo json_encode($data);
36 
37 // restore viewtype
$data
Definition: default.php:25
elgg_view_entity_icon(\ElggEntity $entity, $size= 'medium', $vars=[])
View the icon of an entity.
Definition: views.php:899
if(!$owner) $icon
Definition: default.php:16
elgg_get_viewtype()
Return the current view type.
Definition: views.php:78
elgg_view_image_block($image, $body, $vars=[])
Wrapper function for the image block display pattern.
Definition: views.php:1177
if(!$entity instanceof ElggEntity) $input_name
Definition: default.php:14
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
elgg echo
Translates a string.
Definition: languages.js:43
$viewtype
Definition: default.php:11
if(!array_key_exists($size, $icon_sizes)) $vars['size']
Definition: default.php:27
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
$entity
Definition: default.php:16
$title
Definition: default.php:31
$label
Definition: default.php:21
elgg_set_viewtype($viewtype= '')
Manually set the viewtype.
Definition: views.php:65
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246