Elgg  Version 3.0
item.php
Go to the documentation of this file.
1 <?php
10 $content = elgg_extract('content', $vars);
12 
14  'class' => elgg_extract_class($vars, 'elgg-item', 'item_class'),
15 ];
16 
17 if ($item instanceof \ElggEntity) {
18  $guid = $item->guid;
19  $type = $item->type;
20  $subtype = $item->getSubtype();
21 
22  $li_attrs['id'] = "elgg-$type-$guid";
23 
24  $li_attrs['class'][] = "elgg-item-$type";
25  if ($subtype) {
26  $li_attrs['class'][] = "elgg-item-$type-$subtype";
27  }
28 } elseif ($item instanceof \ElggRiverItem) {
29  $type = $item->getType();
30 
31  $li_attrs['id'] = "item-$type-{$item->id}";
32 
33  $li_attrs['class'][] = "elgg-item-$type";
34 
35  $object = $item->getObjectEntity();
36  if ($object instanceof \ElggEntity) {
37  $li_attrs['class'][] = "elgg-item-{$type}-{$object->getType()}-{$object->getSubtype()}-{$item->action_type}";
38  }
39 } elseif (is_callable([$item, 'getType'])) {
40  $type = $item->getType();
41 
42  $li_attrs['id'] = "item-$type-{$item->id}";
43 }
44 
$subtype
Definition: item.php:15
$object
Definition: item.php:9
$guid
Removes an admin notice.
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:1153
$content
View a item to use in a list.
Definition: item.php:10
$item
Definition: item.php:12
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
$li_attrs
Definition: item.php:13
if(!$entity instanceof ElggEntity) $type
Definition: item.php:14
elgg echo
Translates a string.
Definition: languages.js:43
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif(is_callable([$item, 'getType']))
Definition: item.php:39
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
$vars['type']
Definition: save.php:11