Elgg  Version master
item.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 $type = $entity->getType();
15 $subtype = $entity->getSubtype();
16 
17 $views = [
18  "input/autocomplete/{$type}/{$subtype}",
19  "input/autocomplete/{$type}/default",
20  'input/autocomplete/default',
21 ];
22 foreach ($views as $view) {
23  if (elgg_view_exists($view)) {
24  echo elgg_view($view, $vars);
25  return;
26  }
27 }
28 
29 elgg_log("No autocomplete item view could be found for {$entity->guid}", 'WARNING');
$subtype
Definition: item.php:15
$entity
Item view for generating HTML of an entity in an input/autocomplete (or input/entitypicker) ...
Definition: item.php:9
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:156
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
Definition: upload.php:39
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:86
if(!$entity instanceof ElggEntity) $type
Definition: item.php:14
$vars
Definition: theme.php:5
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:131
$views
Definition: item.php:17