Elgg
Version 1.11
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
views
default
input
checkbox.php
Go to the documentation of this file.
1
<?php
23
$vars
[
'class'
] = (array)
elgg_extract
(
'class'
,
$vars
, []);
24
$vars
[
'class'
][] =
'elgg-input-checkbox'
;
25
26
$defaults
= array(
27
'default'
=> 0,
28
'disabled'
=>
false
,
29
'type'
=>
'checkbox'
30
);
31
32
$vars
= array_merge(
$defaults
,
$vars
);
33
34
$default
=
$vars
[
'default'
];
35
unset(
$vars
[
'default'
]);
36
37
if
(isset(
$vars
[
'name'
]) &&
$default
!==
false
) {
38
echo
elgg_view
(
'input/hidden'
, [
'name'
=>
$vars
[
'name'
],
'value'
=>
$default
]);
39
}
40
41
$label
=
elgg_extract
(
'label'
,
$vars
,
false
);
42
$label_class
=
elgg_extract
(
'label_class'
,
$vars
);
43
unset(
$vars
[
'label'
]);
44
unset(
$vars
[
'label_class'
]);
45
46
$input
=
elgg_format_element
(
'input'
,
$vars
);
47
48
if
(!empty(
$label
)) {
49
echo
elgg_format_element
(
'label'
, [
'class'
=>
$label_class
],
"$input $label"
);
50
}
else
{
51
echo
$input
;
52
}
$label_class
$label_class
Definition:
checkbox.php:42
$default
$default
Definition:
checkbox.php:34
$input
$input
Definition:
checkbox.php:46
elgg_extract
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition:
elgglib.php:1246
elgg_format_element
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition:
output.php:215
echo
elgg echo
Translates a string.
Definition:
languages.js:43
elgg_view
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition:
views.php:354
$vars
$vars['class']
Definition:
checkbox.php:23
$defaults
$defaults
Definition:
checkbox.php:26
$label
if(isset($vars['name'])&&$default!==false) $label
Definition:
checkbox.php:41
Generated on Sat Dec 21 2024 00:00:50 for Elgg by
1.8.11