GF_Field_MultiSelect
Class GF_Field_MultiSelect
Allows the creation of multiselect fields.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:17
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$_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() | Returns the class names of the settings which should be available on the field in the form editor. |
is_conditional_logic_supported() | Indicates this field type can be used when configuring conditional logic rules. |
is_value_submission_array() | Whether this field expects an array during submission. |
get_field_input() | Returns the field inner markup. |
get_choices() | Helper for retrieving the markup for the choices. |
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_save_input() | Sanitize and format the value before it is saved to the Entry Object. |
get_value_merge_tag() | Format the entry value for when the field/input merge tag is processed. |
get_value_export() | Format the entry value before it is used in entry exports and by framework add-ons using GFAddOn::get_field_value(). |
to_string() | Converts an array to a string. |
to_array() | Converts a string to an array. |
sanitize_settings() | Forces settings into expected values while saving the form object. |
get_filter_operators() | Returns the filter operators for the current field. |
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_for_state_validation() | Returns the value to use when the state is validated. |
Method Reference
get_form_editor_field_title()
public function get_form_editor_field_title()
Returns the field title.
Returns
string— The field title. Escaped.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:38
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-multiselect.php:49
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-multiselect.php:62
get_form_editor_field_settings()
function get_form_editor_field_settings()
Returns the class names of the settings which should be available on the field in the form editor.
Returns
array— Settings available within the field editor.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:74
is_conditional_logic_supported()
public function is_conditional_logic_supported()
Indicates this field type can be used when configuring conditional logic rules.
Returns
bool
Source: includes/fields/class-gf-field-multiselect.php:97
is_value_submission_array()
public function is_value_submission_array()
Whether this field expects an array during submission.
Returns
bool
Since: 2.4
Source: includes/fields/class-gf-field-multiselect.php:108
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— The field input HTML markup.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:129
get_choices()
public function get_choices( $value )
Helper for retrieving the markup for the choices.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
Returns
string— Returns the choices available within the multi-select field.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:186
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.
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— $value The value of the field. Escaped.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:208
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.
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— The list items, stored within an unordered list.
Since:
Unknown2.9.29(Changed the second parameter $currency (string) to $entry (array).)
Source: includes/fields/class-gf-field-multiselect.php:228
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-multiselect.php:266
get_value_merge_tag()
public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br )
Format the entry value for when the field/input merge tag is processed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. Depending on the location the merge tag is being used the following functions may have already been applied to the value: esc_html, nl2br, and urlencode. | |
$input_id | string | The field or input ID from the merge tag currently being processed. | |
$entry | array | The Entry Object currently being processed. | |
$form | array | The Form Object currently being processed. | |
$modifier | string | The merge tag modifier. e.g. value | |
$raw_value | string | array | The raw field value from before any formatting was applied to $value. | |
$url_encode | bool | Indicates if the urlencode function may have been applied to the $value. | |
$esc_html | bool | Indicates if the esc_html function may have been applied to the $value. | |
$format | string | The format requested for the location the merge is being used. Possible values: html, text or url. | |
$nl2br | bool | Indicates if the nl2br function may have been applied to the $value. |
Returns
string— $return The merge tag value.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:303
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— $value The value of a field from an export file.
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:350
to_string()
public function to_string( $value )
Converts an array to a string.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | The array to convert to a string. |
Returns
string— The converted string.
Since:
2.2.3.7(Changed access to public.)2.2
Source: includes/fields/class-gf-field-multiselect.php:387
to_array()
public function to_array( $value )
Converts a string to an array.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | A comma-separated or JSON string to convert. |
Returns
array— The converted array.
Since:
2.2.3.7(Changed access to public.)2.2
Source: includes/fields/class-gf-field-multiselect.php:408
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.
Returns
void
Since: Unknown
Source: includes/fields/class-gf-field-multiselect.php:435
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-multiselect.php:455
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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | int | The field or input ID. |
Returns
bool
Since: 3.0
Source: includes/fields/class-gf-field-multiselect.php:468
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-multiselect.php:481
get_value_for_state_validation()
public function get_value_for_state_validation( $value )
Returns the value to use when the state is validated.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The submitted value. |
Returns
array
Since: 3.0
Source: includes/fields/class-gf-field-multiselect.php:494