Elgg  Version master
Variables
checkboxes.php File Reference

Go to the source code of this file.

Variables

 $defaults
 Displays a checkbox input field. More...
 
 $vars = array_merge($defaults, $vars)
 
 $options_values = elgg_extract('options_values', $vars, [])
 
 $input_options = []
 
foreach($options_values as $key=> $value$options = elgg_extract('options', $vars)
 
if(!empty($options)&&empty($input_options)) if(empty($input_options)) $list_class
 
 $id = elgg_extract('id', $vars, '')
 
if(is_array(elgg_extract('value', $vars))) else
 
if($vars['name']&&$vars['default']!==false) $input_vars = $vars
 
 $input_vars ['default'] = false
 
 $checkboxes = ''
 
 foreach ($input_options as $label=> $option)
 

Variable Documentation

$checkboxes = ''

Definition at line 97 of file checkboxes.php.

$defaults
Initial value:
= [
'align' => 'vertical'

Displays a checkbox input field.

Note
This also includes a hidden input with the same name as the checkboxes to make sure something is sent to the server. The default value is 0. If using JS, be specific to avoid selecting the hidden default value: $('input[type=checkbox][name=name]')

string $vars['name'] The name of the input fields (Forced to an array by appending []) array $vars['options'] An array of strings representing the label => option for the each checkbox field array $vars['options_values'] An associative array of 'value' => ['text' => 'option'] string $vars['default'] The default value to send if nothing is checked. Optional, defaults to 0. Set to FALSE for no default. bool $vars['disabled'] Make all input elements disabled. Optional. string $vars['value'] The current value. Single value or array. Optional. string $vars['class'] Additional class of the list. Optional. string $vars['align'] 'horizontal' or 'vertical' Default: 'vertical'

Definition at line 23 of file checkboxes.php.

$id = elgg_extract('id', $vars, '')

Definition at line 70 of file checkboxes.php.

$input_options = []

Definition at line 36 of file checkboxes.php.

if ($vars['name']&&$vars['default']!==false) $input_vars = $vars
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 89 of file checkboxes.php.

$input_vars['default'] = false

Definition at line 90 of file checkboxes.php.

if (!empty($options)&&empty($input_options)) if (empty($input_options)) $list_class
Initial value:
'elgg-input-checkboxes',
"elgg-{$vars['align']}",
])
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
$vars
Definition: checkboxes.php:31

Definition at line 64 of file checkboxes.php.

foreach ($options_values as $key=> $value) $options = elgg_extract('options', $vars)

Definition at line 52 of file checkboxes.php.

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

Definition at line 33 of file checkboxes.php.

$vars = array_merge($defaults, $vars)

Definition at line 31 of file checkboxes.php.

if (is_array(elgg_extract('value', $vars))) else
Initial value:
{
$values = [elgg_strtolower((string) elgg_extract('value', $vars))]
elgg_strtolower()
Wrapper function for mb_strtolower().
Definition: mb_wrapper.php:125
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
$vars
Definition: checkboxes.php:31

Definition at line 75 of file checkboxes.php.

foreach($input_options as $label=> $option)

Definition at line 98 of file checkboxes.php.