Elgg  Version master
checkbox.php
Go to the documentation of this file.
1 <?php
14 if ($item instanceof \ElggEntity) {
15  $default_value = $item->guid;
16 } elseif ($item instanceof \ElggExtender) {
17  $default_value = $item->id;
18 }
19 
21 if ($value === false) {
22  // no value to select
23  return;
24 }
25 
26 $name = elgg_extract('name', $vars, 'item_id[]');
27 
28 echo elgg_view('input/checkbox', [
29  'name' => $name,
30  'value' => $value,
31  'default' => false,
32 ]);
if($item instanceof\ElggEntity) elseif($item instanceof\ElggExtender) $value
Definition: checkbox.php:20
$item
Render checkbox selector to select the ID of the item.
Definition: checkbox.php:12
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
Definition: item.php:48
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
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$default_value
Definition: checkbox.php:13
if($value===false) $name
Definition: checkbox.php:26
$vars['class']
Elgg checkbox input Displays a checkbox input tag.
Definition: checkbox.php:21