Elgg  Version master
item.php
Go to the documentation of this file.
1 <?php
10 $content = (string) 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 ($item instanceof \ElggRelationship) {
40  $type = $item->getType();
41  $relationship = $item->getSubtype();
42  $id = $item->id;
43 
44  $li_attrs['id'] = "elgg-{$type}-{$id}";
45 
46  $li_attrs['class'][] = "elgg-item-{$type}";
47  $li_attrs['class'][] = "elgg-item-{$type}-{$relationship}";
48 } elseif (is_callable([$item, 'getType'])) {
49  $type = $item->getType();
50 
51  $li_attrs['id'] = "item-$type-{$item->id}";
52 }
53 
$subtype
Definition: item.php:15
$object
Definition: item.php:9
$relationship
Elgg default relationship view.
Definition: default.php:10
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:276
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
Definition: item.php:48
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
$content
View a item to use in a list.
Definition: item.php:10
$item
A single element of a menu.
Definition: item.php:9
$li_attrs
Definition: item.php:13
if(!$entity instanceof ElggEntity) $type
Definition: item.php:14
$vars['head']
Definition: html.php:24
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:130
$id
Generic annotation delete action.
Definition: delete.php:6
$guid
Reset an ElggUpgrade.
Definition: reset.php:6