Elgg  Version 6.2
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

$checkboxes = ''

Definition at line 97 of file checkboxes.php.

◆ $defaults

$defaults
Initial value:
= [
'align' => 'vertical',
'value' => [],
'default' => 0,
'options' => [],
'name' => '',
]

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]')

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

Definition at line 23 of file checkboxes.php.

◆ $id

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

Definition at line 70 of file checkboxes.php.

◆ $input_options

$input_options = []

Definition at line 36 of file checkboxes.php.

◆ $input_vars [1/2]

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 [2/2]

$input_vars[ 'default'] = false

Definition at line 90 of file checkboxes.php.

◆ $list_class

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

Definition at line 64 of file checkboxes.php.

◆ $options

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

Definition at line 52 of file checkboxes.php.

◆ $options_values

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

Definition at line 33 of file checkboxes.php.

◆ $vars

$vars = array_merge($defaults, $vars)

Definition at line 31 of file checkboxes.php.

◆ else

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

Definition at line 75 of file checkboxes.php.

◆ foreach

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

Definition at line 98 of file checkboxes.php.