Elgg  Version 4.3
entity.php
Go to the documentation of this file.
1 <?php
2 
3 $entity = elgg_extract('entity', $vars);
4 if (!$entity instanceof ElggEntity) {
5  return;
6 }
7 
8 $type = $entity->getType();
9 $subtype = $entity->getSubtype();
10 
11 $views = [
12  "search/$type/$subtype",
13  "search/$type/default",
14 ];
15 
16 foreach ($views as $view) {
17  if (elgg_view_exists($view)) {
18  echo elgg_view($view, $vars);
19  return;
20  }
21 }
22 
23 echo json_encode($entity->toObject());
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:152
$views
Definition: entity.php:11
$subtype
Definition: entity.php:9
$entity
Definition: entity.php:3
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
if(!$entity instanceof ElggEntity) $type
Definition: entity.php:8
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:547
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179