GF_Field_Checkbox
Source: includes/fields/class-gf-field-checkbox.php:9
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$type | string | The field type. |
$_supports_state_validation | bool | Indicates if this field supports state validation. |
Methods
| Method | Description |
|---|---|
get_form_editor_field_title() | Returns the field title. |
get_form_editor_field_description() | Returns the field's form editor description. |
get_form_editor_field_icon() | Returns the field's form editor icon. |
get_form_editor_field_settings() | The class names of the settings which should be available on the field in the form editor. |
is_conditional_logic_supported() | Indicate if this field type can be used when configuring conditional logic rules. |
get_field_container_tag() | Returns the HTML tag for the field container. |
get_field_input() | Returns the field inner markup. |
get_limit_message() | Get the message that describes the choice limit. |
get_limit_message_text() | Get the text of the choice limit message, or return false if there is no limit. |
get_legacy_field_input() | Returns the field inner markup. |
get_value_submission() | Retrieve the field value on submission. |
skip_state_validation_if_blank() | Indicates if state validation should be skipped if the submitted value is blank. |
get_values_for_state_hash() | Prepares the value that will be hashed on form display as part of the state. |
get_value_entry_list() | Format the entry value for display on the entries list page. |
get_value_entry_detail() | Format the entry value for display on the entry detail page and for the {all_fields} merge tag. |
get_value_merge_tag() | Gets merge tag values. |
get_value_save_input() | Sanitize and format the value before it is saved to the Entry Object. |
get_entry_inputs() | Return the entry inputs in the order they are configured in the form editor. |
get_value_export() | Format the entry value before it is used in entry exports and by framework add-ons using GFAddOn::get_field_value(). |
get_checkbox_choices() | Get checkbox choice inputs for field. |
get_choice_aria_describedby() | Get the aria-describedby attribute for the first choice. |
is_checkbox_checked() | Determine if a specific checkbox is checked. |
get_first_input_id() | Returns the input ID to be assigned to the field label for attribute. |
get_value_default() | Retrieve the field default value. |
allow_html() | If the field should allow html tags to be saved with the entry value. Default is false. |
sanitize_settings() | Forces settings into expected values while saving the form object. |
sanitize_entry_value() | Strip scripts and some HTML tags. |
get_filter_operators() | Returns the filter operators for the current field. |
Method Reference
get_form_editor_field_title()
public function get_form_editor_field_title()
Returns the field title.
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:35
get_form_editor_field_description()
public function get_form_editor_field_description()
Returns the field's form editor description.
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-checkbox.php:48
get_form_editor_field_icon()
public function get_form_editor_field_icon()
Returns the field's form editor icon.
This could be an icon url or a gform-icon class.
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-checkbox.php:61
get_form_editor_field_settings()
public function get_form_editor_field_settings()
The class names of the settings which should be available on the field in the form editor.
Returns
array
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:73
is_conditional_logic_supported()
public function is_conditional_logic_supported()
Indicate if this field type can be used when configuring conditional logic rules.
Returns
bool
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:101
get_field_container_tag()
public function get_field_container_tag( $form )
Returns the HTML tag for the field container.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The current Form object. |
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-checkbox.php:116
get_field_input()
public function get_field_input( $form, $value='', $entry=null )
Returns the field inner markup.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. | |
$value | string | array | '' | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
$entry | null | array | null | Null or the Entry Object currently being edited. |
Returns
string
Since:
Unknown2.5(Implement Select All directly.)2.7(Addedgfield_choice_all_toggleclass to Select All button.)
Source: includes/fields/class-gf-field-checkbox.php:145
get_limit_message()
public function get_limit_message()
Get the message that describes the choice limit.
Returns
string
Since: 2.9.0
Source: includes/fields/class-gf-field-checkbox.php:243
get_limit_message_text()
public function get_limit_message_text()
Get the text of the choice limit message, or return false if there is no limit.
Returns
false|string
Since: 2.9.0
Source: includes/fields/class-gf-field-checkbox.php:269
get_legacy_field_input()
public function get_legacy_field_input( $form, $value='', $entry=null )
Returns the field inner markup.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. | |
$value | string | array | '' | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
$entry | null | array | null | Null or the Entry Object currently being edited. |
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-checkbox.php:376
get_value_submission()
public function get_value_submission( $field_values, $get_from_post_global_var=true )
Retrieve the field value on submission.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_values | array | The dynamic population parameter names with their corresponding values to be populated. | |
$get_from_post_global_var | bool | true | true | Whether to get the value from the $_POST array as opposed to $field_values. |
Returns
array|string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:462
skip_state_validation_if_blank()
public function skip_state_validation_if_blank( $key )
Indicates if state validation should be skipped if the submitted value is blank.
Input value will be blank when the input is not checked.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key |
Returns
bool
Since: 3.0
Source: includes/fields/class-gf-field-checkbox.php:561
get_values_for_state_hash()
public function get_values_for_state_hash( $value )
Prepares the value that will be hashed on form display as part of the state.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The default value. |
Returns
null|array
Since: 3.0
Source: includes/fields/class-gf-field-checkbox.php:574
get_value_entry_list()
public function get_value_entry_list( $value, $entry, $field_id, $columns, $form )
Format the entry value for display on the entries list page.
Return a value that's safe to display on the page.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. | |
$entry | array | The Entry Object currently being processed. | |
$field_id | string | The field or input ID currently being processed. | |
$columns | array | The properties for the columns being displayed on the entry list page. | |
$form | array | The Form Object currently being processed. |
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:620
get_value_entry_detail()
public function get_value_entry_detail( $value, $entry=[], $use_text=false, $format='html', $media='screen' )
Format the entry value for display on the entry detail page and for the {all_fields} merge tag.
Return a value that's safe to display for the context of the given $format.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. | |
$entry | array | [] | The entry. |
$use_text | bool | false | false | When processing choice based fields should the choice text be returned instead of the value. |
$format | string | 'html' | The format requested for the location the merge is being used. Possible values: html, text or url. |
$media | string | 'screen' | The location where the value will be displayed. Possible values: screen or email. |
Returns
string
Since:
Unknown2.9.29(Changed the second parameter $currency (string) to $entry (array).)
Source: includes/fields/class-gf-field-checkbox.php:670
get_value_merge_tag()
public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br )
Gets merge tag values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | string | The value of the input. | |
$input_id | string | The input ID to use. | |
$entry | array | The Entry Object. | |
$form | array | The Form Object | |
$modifier | string | The modifier passed. | |
$raw_value | array | string | The raw value of the input. | |
$url_encode | bool | If the result should be URL encoded. | |
$esc_html | bool | If the HTML should be escaped. | |
$format | string | The format that the value should be. | |
$nl2br | bool | If the nl2br function should be used. |
Returns
string— The processed merge tag.
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:742
get_value_save_input()
public function get_value_save_input( $value, $form, $input_name, $entry_id, $entry, $repeater_index='' )
Sanitize and format the value before it is saved to the Entry Object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | The value to be saved. | |
$form | array | The Form object currently being processed. | |
$input_name | string | The input name used when accessing the $_POST. | |
$entry_id | int | The ID of the entry currently being processed. | |
$entry | array | The entry currently being processed. | |
$repeater_index | string | '' | The repeater index if the field is inside a repeater. |
Returns
array|string— The sanitized and formatted input value to be saved.
Since: 3.0.0
Source: includes/fields/class-gf-field-checkbox.php:817
get_entry_inputs()
public function get_entry_inputs()
Return the entry inputs in the order they are configured in the form editor.
Returns
array|null
Since: 2.9
Source: includes/fields/class-gf-field-checkbox.php:854
get_value_export()
public function get_value_export( $entry, $input_id='', $use_text=false, $is_csv=false )
Format the entry value before it is used in entry exports and by framework add-ons using GFAddOn::get_field_value().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The entry currently being processed. | |
$input_id | string | '' | The field or input ID. |
$use_text | bool | false | false | When processing choice based fields should the choice text be returned instead of the value. |
$is_csv | bool | false | false | Is the value going to be used in the .csv entries export? |
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:887
get_checkbox_choices()
public function get_checkbox_choices( $value, $disabled_text, $form_id=0 )
Get checkbox choice inputs for field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. | |
$disabled_text | string | The HTML disabled attribute. | |
$form_id | int | 0 | The current form ID. |
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:944
get_choice_aria_describedby()
public function get_choice_aria_describedby( $form_id, $describedby=[] )
Get the aria-describedby attribute for the first choice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | The current form ID. | |
$describedby | array | [] | Additional describedby attribute value. |
Returns
string
Since: 2.9.0
Source: includes/fields/class-gf-field-checkbox.php:1153
is_checkbox_checked()
public function is_checkbox_checked( $field_id, $field_label, $entry )
Determine if a specific checkbox is checked.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_id | int | Field ID. | |
$field_label | string | Field label. | |
$entry | array | Entry object. |
Returns
bool
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1179
get_first_input_id()
public function get_first_input_id( $form )
Returns the input ID to be assigned to the field label for attribute.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. |
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1248
get_value_default()
public function get_value_default()
Retrieve the field default value.
Returns
array|string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1265
allow_html()
public function allow_html()
If the field should allow html tags to be saved with the entry value. Default is false.
Returns
bool
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1285
sanitize_settings()
public function sanitize_settings()
Forces settings into expected values while saving the form object.
No escaping should be done at this stage to prevent double escaping on output.
Currently called only for forms created after version 1.9.6.10.
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1302
sanitize_entry_value()
public function sanitize_entry_value( $value, $form_id )
Strip scripts and some HTML tags.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | The field value to be processed. | |
$form_id | int | The ID of the form currently being processed. |
Returns
string
Since: Unknown
Source: includes/fields/class-gf-field-checkbox.php:1329
get_filter_operators()
public function get_filter_operators()
Returns the filter operators for the current field.
Returns
array
Since: 2.4
Source: includes/fields/class-gf-field-checkbox.php:1366