Elgg  Version 6.1
switch.php
Go to the documentation of this file.
1 <?php
11 $current_value = (bool) elgg_extract('value', $vars, false);
12 
13 $vars['class'] = elgg_extract_class($vars, 'elgg-input-switch');
14 $vars['switch'] = true;
15 $vars['default'] = 0;
16 $vars['value'] = 1;
17 $vars['checked'] = $current_value;
18 
19 echo elgg_view('input/checkbox', $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_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
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
$current_value
Elgg switch input.
Definition: switch.php:11
$vars['class']
Definition: switch.php:13