Elgg  Version master
userpicker.php
Go to the documentation of this file.
1 <?php
10 $options = (array) elgg_extract('options', $vars, []);
11 
12 $options['include_banned'] = (bool) elgg_extract('include_banned', $vars, false);
13 $options['friends_only'] = (bool) elgg_extract('only_friends', $vars, false);
14 
15 $show_friends = (bool) elgg_extract('show_friends', $vars, true) && !$options['friends_only'];
16 
18 if ($show_friends) {
19  $vars['picker_extras'] = elgg_view('input/checkbox', [
20  'name' => 'match_on',
21  'value' => 'friends',
22  'default' => elgg_extract('match_on', $vars, 'users', false),
23  'label' => elgg_echo('userpicker:only_friends'),
24  ]);
25 } elseif ($options['friends_only']) {
26  $default_match_on = 'friends';
27 }
28 
29 if (!isset($vars['name'])) {
30  $vars['name'] = 'members';
31 }
32 
33 $vars['match_on'] = elgg_extract('match_on', $vars, $default_match_on);
34 $vars['class'] = elgg_extract_class($vars, ['elgg-user-picker']);
35 $vars['options'] = $options;
36 
37 echo elgg_view('input/entitypicker', $vars);
if($show_friends) elseif($options['friends_only']) if(!isset($vars['name'])) $vars['match_on']
Definition: userpicker.php:33
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
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
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$default_match_on
Definition: userpicker.php:17
elgg_extract_class(array $array, array|string $existing=[], string $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:277
$options
Elgg user picker.
Definition: userpicker.php:10
$show_friends
Definition: userpicker.php:15