Elgg  Version master
Variables
entitypicker.php File Reference

Go to the source code of this file.

Variables

 $name = elgg_extract('name', $vars, 'entities', false)
 Entity Picker. More...
 
 $guids = (array) elgg_extract('values', $vars, elgg_extract('value', $vars, []))
 
 $limit = (int) elgg_extract('limit', $vars, 0)
 
 $save_as_array = (bool) elgg_extract('save_as_array', $vars, true)
 
if($limit !==1) $params = elgg_extract('options', $vars, [])
 
if(!empty($params)) $params ['view'] = 'json'
 
 $params ['save_as_array'] = $save_as_array
 
 $wrapper_options
 
 $picker
 
 $item_view = elgg_extract('item_view', $vars, 'input/autocomplete/item')
 
 $items = ''
 
foreach($guids as $guid) $list_class
 

Variable Documentation

◆ $guids

$guids = (array) elgg_extract('values', $vars, elgg_extract('value', $vars, []))

Definition at line 23 of file entitypicker.php.

◆ $item_view

$item_view = elgg_extract('item_view', $vars, 'input/autocomplete/item')

Definition at line 66 of file entitypicker.php.

◆ $items

$items = ''

Definition at line 67 of file entitypicker.php.

◆ $limit

$limit = (int) elgg_extract('limit', $vars, 0)

Definition at line 24 of file entitypicker.php.

◆ $list_class

foreach ( $guids as $guid) $list_class
Initial value:
= [
'elgg-list',
'elgg-entity-picker-list',
]

Definition at line 81 of file entitypicker.php.

◆ $name

$name = elgg_extract('name', $vars, 'entities', false)

Entity Picker.

Sends an array of entity guids.

@uses $vars['values'] Array of user guids for already selected entities or null @uses $vars['limit'] Limit number of entities (default 0 = no limit) @uses $vars['name'] Name of the returned data array (default "entities") @uses $vars['handler'] Name of page handler used to power search (default "livesearch") @uses $vars['options'] Additional options to pass to the handler with the URL query If using custom options, make sure to impose a signed request gatekeeper in the resource view @uses $vars['placeholder'] Optional placeholder text for the input @uses $vars['item_view'] The item view to use for the display of the values (default 'input/autocomplete/item') @uses $vars['sortable'] Boolean to control if items in the list are sortable

Defaults to lazy load entity lists in alphabetical order. User needs to type two characters before seeing the user popup list.

As entities are selected they move down to a "entities" box. When this happens, a hidden input is created to return the GUID in the array with the form

Definition at line 21 of file entitypicker.php.

◆ $params [1/3]

if ( $limit !==1) $params = elgg_extract('options', $vars, [])

Definition at line 31 of file entitypicker.php.

◆ $params [2/3]

$params[ 'save_as_array'] = $save_as_array

Definition at line 43 of file entitypicker.php.

◆ $params [3/3]

if (!empty( $params)) $params[ 'view'] = 'json'

Definition at line 42 of file entitypicker.php.

◆ $picker

if (elgg_extract( 'sortable', $vars)) $picker
Initial value:
= elgg_format_element('input', [
'type' => 'text',
'class' => [
'elgg-input-entity-picker',
],
'size' => 30,
'id' => elgg_extract('id', $vars),
'placeholder' => elgg_extract('placeholder', $vars),
])
$vars
Definition: theme.php:3
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_format_element(string $tag_name, array $attributes=[], string $text='', array $options=[])
Format an HTML element.
Definition: output.php:145

Definition at line 53 of file entitypicker.php.

◆ $save_as_array

$save_as_array = (bool) elgg_extract('save_as_array', $vars, true)

Definition at line 26 of file entitypicker.php.

◆ $wrapper_options

$wrapper_options
Initial value:
= [
'class' => elgg_extract_class($vars, ['elgg-entity-picker']),
'data-limit' => $limit,
'data-name' => $name,
'data-match-on' => elgg_extract('match_on', $vars, 'entities', false),
'data-handler' => elgg_http_add_url_query_elements(elgg_extract('handler', $vars, 'livesearch'), $params),
]
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:269
elgg_http_add_url_query_elements(string $url, array $elements)
Sets elements in a URL's query string.
Definition: elgglib.php:173
if($limit !==1) $params
$name
Entity Picker.
$limit

Definition at line 45 of file entitypicker.php.