Get or set current checkbox boolean attribute state
Available since version 3.0.133.
Example
// the following two lines are equivalent to GET checkbox state
$checked = $f->checked();
$checked = !empty($f->attr('checked'));
// the following two lines are equivalent to SET checkbox state
$f->checked(true);
$f->attr('checked', 'checked');
Usage
// basic usage
$bool = $inputfieldCheckbox->checked();
// usage with all arguments
$bool = $inputfieldCheckbox->checked($checked = null);
Arguments
Name | Type(s) | Description |
---|---|---|
checked (optional) |
Return value
bool
InputfieldCheckbox methods and properties
API reference based on ProcessWire core version 3.0.236