InputfieldCheckbox class

An Inputfield for handling a single checkbox

Note: if you want a checkbox already checked, you need to $inputfield->setAttribute('checked', 'checked');


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the InputfieldCheckbox class also inherits all the methods and properties of: Inputfield, WireData and Wire.

Show class?     Show args?       Only hookable?    

Properties

NameReturnSummary 
InputfieldCheckbox::autocheck int When set to 1, setting value attribute to non-blank/non-zero automatically triggers checked.
DEFAULT: 0
 
InputfieldCheckbox::checkboxLabel string Same as label2, but used as part of field config rather than API-only config. 
InputfieldCheckbox::checkboxOnly bool Show only the checkbox without label text next to it? 3.0.144
DEFAULT: false
 
InputfieldCheckbox::checkedValue string Value when checked
DEFAULT: 1
 
InputfieldCheckbox::label2 string Alterate label to display next to checkbox
DEFAULT: label
 
InputfieldCheckbox::labelAttrs array Optional attributes for <label> element that surrounds checkbox 3.0.141
DEFAULT: []
 
InputfieldCheckbox::uncheckedValue string Value when not checked
DEFAULT: ''
 

Additional methods and properties

In addition to the methods and properties above, InputfieldCheckbox also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252