Elgg  Version 4.3
Variables
select.php File Reference

Go to the source code of this file.

Variables

 $vars ['class']
 Elgg select input Displays a select input field. More...
 
 $defaults
 
 $options_values = []
 
 $options = elgg_extract('options', $vars, [])
 
 $normalize_options
 
 $value = is_array($vars['value']) ? $vars['value'] : [$vars['value']]
 
 $vars ['multiple'] = !empty($vars['multiple'])
 
if($vars['multiple']&&!empty($vars['name'])&&is_string($vars['name'])) $render_option
 
 $options_list = ''
 
 foreach ($options_values as $option)
 

Variable Documentation

$defaults
Initial value:
= [
'disabled' => false

Definition at line 30 of file select.php.

$normalize_options
Initial value:
= function($options) use (&$normalize_options) {
foreach ($options as $key => $option) {
if (!is_array($option)) {
$option = [
'text' => $option,
'value' => $key,
];
}
$optgroup = elgg_extract('options', $option);
if (is_array($optgroup)) {
$option['options'] = $normalize_options($optgroup);
}
$options[$key] = $option;
}
return $options;
}
$options
Definition: select.php:40
$normalize_options
Definition: select.php:62
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44

Definition at line 62 of file select.php.

$options = elgg_extract('options', $vars, [])

Definition at line 40 of file select.php.

$options_list = ''

Definition at line 118 of file select.php.

$options_values = []

Definition at line 37 of file select.php.

if ($vars['multiple']&&!empty($vars['name'])&&is_string($vars['name'])) $render_option
Initial value:
= function($option) use ($value) {
$opt_value = elgg_extract('value', $option);
$text = elgg_extract('text', $option);
unset($option['text']);
if (!is_string($text) && !is_numeric($text)) {
elgg_log('No text defined for input/select option with value "' . $opt_value . '"', 'NOTICE');
}
if (!isset($option['selected'])) {
$option['selected'] = isset($opt_value) && in_array((string) $opt_value, $value);
}
if (!isset($option['title'])) {
$option['title'] = $text;
}
return elgg_format_element('option', $option, $text);
}
$value
Definition: select.php:84
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:399
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
$text
Definition: button.php:32

Definition at line 97 of file select.php.

$value = is_array($vars['value']) ? $vars['value'] : [$vars['value']]

Definition at line 84 of file select.php.

$vars
Initial value:
'elgg-input-dropdown',
'elgg-input-select',
])
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:569
$vars['class']
Elgg select input Displays a select input field.
Definition: select.php:25

Elgg select input Displays a select input field.

Warning
Values of FALSE or NULL will match '' (empty string) but not 0.

$vars['value'] The current value or an array of current values if multiple is true $vars['options'] An array of strings or arrays representing the options for the dropdown field. If an array is passed, the "text" key is used as its text, all other elements in the array are used as attributes. $vars['options_values'] An associative array of "value" => "option" where "value" is the name and "option" is the value displayed on the button. Replaces $vars['options'] when defined. When "option" is passed as an array, the same behaviour is used as when the $vars['options'] is passed an array to. If the array contains an array of 'options' an optgroup will be drawn with 'label' as the optgroup label. $vars['multiple'] If true, multiselect of values will be allowed in the select box $vars['class'] Additional CSS class

Definition at line 25 of file select.php.

$vars['multiple'] = !empty($vars['multiple'])

Definition at line 88 of file select.php.

foreach($options_values as $option)

Definition at line 120 of file select.php.