Checks if the types of the passed arguments in a function/method call are compatible.
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Renders a collection list item |
||
5 | * |
||
6 | * @uses $vars['item'] Access collection |
||
7 | * @uses $vars['full_view'] Summary/full view flag |
||
8 | */ |
||
9 | $collection = elgg_extract('item', $vars); |
||
10 | if (!$collection instanceof ElggAccessCollection) { |
||
11 | return; |
||
12 | } |
||
13 | |||
14 | $full_view = elgg_extract('full_view', $vars); |
||
15 | |||
16 | $menu = elgg_view_menu('friends:collection', [ |
||
17 | 'collection' => $collection, |
||
18 | 'class' => 'elgg-menu-hz', |
||
19 | 'sort_by' => 'priority', |
||
20 | ]); |
||
21 | |||
22 | $count = $collection->getMembers(['count' => true]); |
||
23 | $subtitle = elgg_echo('friends:collection:member_count', [$count]); |
||
24 | |||
25 | if ($full_view) { |
||
26 | $title = false; |
||
27 | $content = elgg_view('collections/members', [ |
||
28 | 'collection' => $collection, |
||
29 | ]); |
||
30 | |||
31 | $menu = elgg()->menus->getMenu('friends:collection', [ |
||
32 | 'collection' => $collection, |
||
33 | ]); |
||
34 | $items = $menu->getSection('default'); |
||
35 | foreach ($items as $item) { |
||
36 | if ($item->getName() == 'delete') { |
||
37 | $item->addLinkClass('elgg-button elgg-button-delete'); |
||
38 | } else { |
||
39 | $item->addLinkClass('elgg-button elgg-button-action'); |
||
40 | } |
||
41 | elgg_register_menu_item('title', $item); |
||
42 | } |
||
43 | } else { |
||
44 | $title = elgg_view('output/url', [ |
||
45 | 'text' => $collection->name, |
||
46 | 'href' => $collection->getURL(), |
||
47 | ]); |
||
48 | $members = $collection->getMembers([ |
||
49 | 'limit' => 10, |
||
50 | ]); |
||
51 | $content = elgg_view_entity_list($members, [ |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
52 | 'list_type' => 'gallery', |
||
53 | 'size' => 'tiny', |
||
54 | 'gallery_class' => 'elgg-gallery-fluid elgg-gallery-users', |
||
55 | 'pagination' => false, |
||
56 | ]); |
||
57 | } |
||
58 | |||
59 | $params = [ |
||
60 | 'collection' => $collection, |
||
61 | 'metadata' => $menu, |
||
62 | 'title' => $title, |
||
63 | 'subtitle' => $subtitle, |
||
64 | 'content' => $content, |
||
65 | ]; |
||
66 | |||
67 | echo elgg_view('object/elements/summary/metadata', $params); |
||
68 | echo elgg_view('object/elements/summary/title', $params); |
||
69 | echo elgg_view('object/elements/summary/subtitle', $params); |
||
70 | |||
71 | echo elgg_format_element('div', [ |
||
72 | 'class' => 'elgg-body clearfix', |
||
73 | ], $content); |
||
74 |