Skip to main content

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​

PropertyTypeDescription
$repeatableboolWhether the field can be used in a repeater.
$_supports_state_validationboolIndicates if this field supports state validation.

Methods​

MethodDescription
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.
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:47

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:58

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:71

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:83

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:106

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:117

get_field_input()​

public function get_field_input( $form, $value='', $entry=null )

Returns the field inner markup.

Parameters​

NameTypeDefaultDescription
$formarrayThe Form Object currently being processed.
$valuestring | array''The field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
$entrynull | arraynullNull or the Entry Object currently being edited.

Returns​

  • string — The field input HTML markup.

Since: Unknown

Source: includes/fields/class-gf-field-multiselect.php:138

get_choices()​

public function get_choices( $value )

Helper for retrieving the markup for the choices.

Parameters​

NameTypeDefaultDescription
$valuestring | arrayThe 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:195

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​

NameTypeDefaultDescription
$valuestring | arrayThe field value.
$entryarrayThe Entry Object currently being processed.
$field_idstringThe field or input ID currently being processed.
$columnsarrayThe properties for the columns being displayed on the entry list page.
$formarrayThe Form Object currently being processed.

Returns​

  • string — $value The value of the field. Escaped.

Since: Unknown

Source: includes/fields/class-gf-field-multiselect.php:217

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​

NameTypeDefaultDescription
$valuestring | arrayThe field value.
$entryarray[]The entry.
$use_textbool | falsefalseWhen processing choice based fields should the choice text be returned instead of the value.
$formatstring'html'The format requested for the location the merge is being used. Possible values: html, text or url.
$mediastring'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:

  • Unknown
  • 2.9.29 (Changed the second parameter $currency (string) to $entry (array).)

Source: includes/fields/class-gf-field-multiselect.php:237

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​

NameTypeDefaultDescription
$valuestringThe value to be saved.
$formarrayThe Form object currently being processed.
$input_namestringThe input name used when accessing the $_POST.
$entry_idintThe ID of the entry currently being processed.
$entryarrayThe entry currently being processed.
$repeater_indexstring''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
  • 3.0.3 (Updated to use $this->prepare_post_category_value_save_input().)

Source: includes/fields/class-gf-field-multiselect.php:276

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​

NameTypeDefaultDescription
$valuestring | arrayThe 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_idstringThe field or input ID from the merge tag currently being processed.
$entryarrayThe Entry Object currently being processed.
$formarrayThe Form Object currently being processed.
$modifierstringThe merge tag modifier. e.g. value
$raw_valuestring | arrayThe raw field value from before any formatting was applied to $value.
$url_encodeboolIndicates if the urlencode function may have been applied to the $value.
$esc_htmlboolIndicates if the esc_html function may have been applied to the $value.
$formatstringThe format requested for the location the merge is being used. Possible values: html, text or url.
$nl2brboolIndicates 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:316

to_string()​

public function to_string( $value )

Converts an array to a string.

Parameters​

NameTypeDefaultDescription
$valuearrayThe 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:393

to_array()​

public function to_array( $value )

Converts a string to an array.

Parameters​

NameTypeDefaultDescription
$valuestringA 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:414

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:441

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:461

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​

NameTypeDefaultDescription
$keystring | intThe field or input ID.

Returns​

  • bool

Since: 3.0

Source: includes/fields/class-gf-field-multiselect.php:474

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​

NameTypeDefaultDescription
$valuestring | arrayThe default value.

Returns​

  • null | array

Since: 3.0

Source: includes/fields/class-gf-field-multiselect.php:487

get_value_for_state_validation()​

public function get_value_for_state_validation( $value )

Returns the value to use when the state is validated.

Parameters​

NameTypeDefaultDescription
$valuestring | arrayThe submitted value.

Returns​

  • array

Since: 3.0

Source: includes/fields/class-gf-field-multiselect.php:500