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 ElggObject) {
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 
14 $icon = null;
15 if ($entity->hasIcon('tiny')) {
17  'use_link' => false,
18  'href' => false,
19  ]);
20 }
21 
22 $title = elgg_format_element('h3', [], $entity->getDisplayName());
23 
25  'class' => 'elgg-autocomplete-item',
26 ]);
27 
28 $data = $entity->toObject();
29 $data->label = $label;
30 $data->value = $entity->guid;
31 $data->icon = $icon;
32 
34  $data->html = elgg_view('input/autocomplete/item', $vars);
35 }
36 
37 echo json_encode($data);
38 
39 // 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