Gravity_Forms\Gravity_Forms\Settings\Fields\Checkbox
Source: includes/settings/fields/class-checkbox.php:9
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Settings\Fields - Extends:
Base
Properties
| Property | Type | Description |
|---|---|---|
$type | string | Field type. |
$choices | array | Field choices. |
$data_format | string | Data Format. |
Methods
| Method | Description |
|---|---|
markup() | Render field. |
array_markup() | Get the markup for array-style checkbox inputs. |
render_input() | Returns markup for an individual checkbox input and its label. |
do_validation() | Validate posted field value. |
do_array_validation() | Validate posted array field value. |
Method Reference
markup()
public function markup()
Render field.
Returns
string
Since: 2.5
Source: includes/settings/fields/class-checkbox.php:58
array_markup()
public function array_markup()
Get the markup for array-style checkbox inputs.
Returns
string
Since: 2.6
Source: includes/settings/fields/class-checkbox.php:152
render_input()
public static function render_input( $choice, $attributes=[], $value=null, $tooltip='', $data_as_array=false )
Returns markup for an individual checkbox input and its label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$choice | array | Choice array with all configured properties. | |
$attributes | array | [] | Array containing all the attributes for the input tag. |
$value | string | null | Currently selection (1 if field has been checked. 0 or null otherwise). |
$tooltip | string | '' | Tooltip for this checkbox item. |
$data_as_array | string | false | Whether the data should be formatted for array values. |
Returns
string
Since:
2.52.6(Added $data_as_array attribute)
Source: includes/settings/fields/class-checkbox.php:240
do_validation()
public function do_validation( $value )
Validate posted field value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | Posted field value. |
Since: 2.5
Source: includes/settings/fields/class-checkbox.php:306
do_array_validation()
public function do_array_validation( $value )
Validate posted array field value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | Posted field value. |
Since: 2.6
Source: includes/settings/fields/class-checkbox.php:354