Skip to main content

GF_Field_Select

Source: includes/fields/class-gf-field-select.php:8

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_description()Returns the field's form editor description.
get_form_editor_field_icon()Returns the field's form editor icon.
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_merge_tag()Gets merge tag values.
get_value_entry_detail()Format the entry value for display on the entry detail page and for the {all_fields} merge tag.
sanitize_entry_value()Strips all tags from the input value.
get_value_save_input()Sanitize and format the value before it is saved to the Entry Object.
sanitize_settings()Forces settings into expected values while saving the form object.
get_filter_operators()Returns the filter operators for the current field.

Method Reference​

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-select.php:41

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-select.php:54

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.

Value will be blank when the placeholder is selected.

Parameters​

NameTypeDefaultDescription
$keystring | intThe field or input ID.

Returns​

  • bool

Since: 3.0

Source: includes/fields/class-gf-field-select.php:96

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-select.php:109

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​

NameTypeDefaultDescription
$valuearray | stringThe value of the input.
$input_idstringThe input ID to use.
$entryarrayThe Entry Object.
$formarrayThe Form Object
$modifierstringThe modifier passed.
$raw_valuearray | stringThe raw value of the input.
$url_encodeboolIf the result should be URL encoded.
$esc_htmlboolIf the HTML should be escaped.
$formatstringThe format that the value should be.
$nl2brboolIf the nl2br function should be used.

Returns​

  • string — The processed merge tag.

Since: Unknown

Source: includes/fields/class-gf-field-select.php:175

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

Since:

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

Source: includes/fields/class-gf-field-select.php:230

sanitize_entry_value()​

public function sanitize_entry_value( $value, $form_id )

Strips all tags from the input value.

Parameters​

NameTypeDefaultDescription
$valuestringThe field value to be processed.
$form_idintThe ID of the form currently being processed.

Returns​

  • string

Since:

  • 1.9
  • 2.9.18 (Added check for state validation.)

Source: includes/fields/class-gf-field-select.php:270

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-select.php:300

sanitize_settings()​

public function sanitize_settings()

Forces settings into expected values while saving the form object.

Returns​

  • void

Since: 2.9.16

Source: includes/fields/class-gf-field-select.php:318

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-select.php:332