Elgg  Version 4.3
checkboxes.php File Reference

Go to the source code of this file.


 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 96 of file checkboxes.php.

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

Displays a checkbox input field.

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 37 of file checkboxes.php.

if ($vars['name']&&$vars['default']!==false) $input_vars = $vars

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_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:569
Definition: checkboxes.php:32

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 34 of file checkboxes.php.

$vars = array_merge($defaults, $vars)

Definition at line 32 of file checkboxes.php.

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

Definition at line 75 of file checkboxes.php.

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

Definition at line 97 of file checkboxes.php.