Elgg  Version 1.9
checkbox.php
Go to the documentation of this file.
1 <?php
23 if (isset($vars['class'])) {
24  $vars['class'] = "elgg-input-checkbox {$vars['class']}";
25 } else {
26  $vars['class'] = "elgg-input-checkbox";
27 }
28 
29 $defaults = array(
30  'default' => 0,
31  'disabled' => false,
32 );
33 
34 $vars = array_merge($defaults, $vars);
35 
36 $default = $vars['default'];
37 unset($vars['default']);
38 
39 if (isset($vars['name']) && $default !== false) {
40  echo "<input type=\"hidden\" name=\"{$vars['name']}\" value=\"$default\"/>";
41 }
42 
43 if (isset($vars['label'])) {
44  if (isset($vars['label_class'])) {
45  echo "<label class=\"{$vars['label_class']}\">";
46  } else {
47  echo "<label>";
48  }
49 }
50 ?>
51 <input type="checkbox" <?php echo elgg_format_attributes($vars); ?> />
52 <?php
53 if (isset($vars['label'])) {
54  echo "{$vars['label']}</label>";
55 }
$default
Definition: checkbox.php:36
elgg echo
Translates a string.
Definition: languages.js:43
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition: output.php:118
list style type
Definition: admin.php:724
elgg table input[type=checkbox]
Definition: admin.php:392
$defaults
Definition: checkbox.php:29
$vars
Definition: checkbox.php:34