Elgg  Version master
groups.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
8  'query' => elgg_extract('term', $vars),
9  'type' => 'group',
10  'limit' => elgg_extract('limit', $vars),
11  'save_as_array' => (bool) elgg_extract('save_as_array', $vars, true),
12  'sort_by' => [
13  'property_type' => 'metadata',
14  'property' => 'name',
15  'direction' => 'ASC',
16  ],
17  'fields' => ['metadata' => ['name']],
18  'item_view' => elgg_extract('item_view', $vars, 'search/entity'),
19  'input_name' => elgg_extract('name', $vars),
20 ];
21 
22 $target_guid = (int) elgg_extract('match_target', $vars);
23 if ($target_guid) {
25 } else {
27 }
28 
29 if (!$target instanceof \ElggEntity || !$target->canEdit()) {
30  throw new EntityPermissionsException();
31 }
32 
33 if (elgg_extract('match_owner', $vars, false)) {
34  $options['owner_guid'] = (int) $target->guid;
35 }
36 
37 if (elgg_extract('match_membership', $vars, false)) {
38  $options['relationship'] = 'member';
39  $options['relationship_guid'] = $target->guid;
40 }
41 
42 $body = elgg_list_entities($options, 'elgg_search');
43 
44 echo elgg_view_page('', $body);
$vars
Definition: theme.php:3
Thrown when entity can not be edited or container permissions do not allow it to be written.
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:246
elgg_list_entities(array $options=[], ?callable $getter=null, ?callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:68
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: gatekeepers.php:64
$options
Definition: groups.php:7
if(! $target instanceof \ElggEntity||! $target->canEdit()) if(elgg_extract('match_owner', $vars, false)) if(elgg_extract('match_membership', $vars, false)) $body
Definition: groups.php:42
$target_guid
Definition: groups.php:22
elgg_view_page(string $title, string|array $body, string $page_shell='default', array $vars=[])
Assembles and outputs a full page.
Definition: views.php:235
$target
Definition: create.php:17
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:24