Skip to main content

GF_Field_List

Class GF_Field_List

Handles the behavior of List fields.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:15

Details

  • Kind: class
  • Namespace: (global)
  • Extends: GF_Field

Properties

PropertyTypeDescription
$typestringThe field type.

Methods

MethodDescription
get_form_editor_field_title()Sets the field title to be displayed in the form editor.
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()Defines the field settings available in the form editor.
get_first_input_id()Gets the ID of the first input.
get_field_container_tag()Returns the HTML tag for the field container.
get_field_input()Builds the field input HTML markup.
get_legacy_field_input()Builds the field input HTML markup.
get_list_input()Builds the input that will be inside the List field.
get_field_label_class()Get field label class.
is_value_submission_array()Whether this field expects an array during submission.
get_value_submission()Gets the value of te field from the form submission.
create_list_array_recursive()Creates an array from the list items. Recurses if the field is inside a Repeater.
is_value_submission_empty()Check if the submission value is empty.
get_value_entry_detail()Gets the field value HTML markup to be used on the entry detail page.
get_value_save_input()Sanitize and format the value before it is saved to the Entry Object.
get_value_merge_tag()Gets merge tag values.
get_value_entry_list()Format the entry value for display on the entries list page.
create_list_array()Creates an array from the list items.
to_array()Converts a string to an array.
sanitize_settings()Sanitizes the field settings.
get_value_export()Gets the field value, formatted for exports. For CSV export return an array.
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()

Sets the field title to be displayed in the form editor.

Returns

  • string — The field title. Escaped and translatable.

Since: Unknown

Source: includes/fields/class-gf-field-list.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-list.php:46

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-list.php:59

get_form_editor_field_settings()

function get_form_editor_field_settings()

Defines the field settings available in the form editor.

Returns

  • array — The settings available.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:73

get_first_input_id()

public function get_first_input_id( $form )

Gets the ID of the first input.

Parameters

NameTypeDefaultDescription
$formarrayThe Form Object.

Returns

  • string — The ID of the first input. Empty string if not found.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:105

get_field_container_tag()

public function get_field_container_tag( $form )

Returns the HTML tag for the field container.

Parameters

NameTypeDefaultDescription
$formarrayThe current Form object.

Returns

  • string

Since: 2.5

Source: includes/fields/class-gf-field-list.php:128

get_field_input()

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

Builds the field input HTML markup.

Parameters

NameTypeDefaultDescription
$formarrayThe Form Object.
$valuestring''The field value. Defaults to empty string.
$entrynull | arraynullThe Entry Object. Defaults to null.

Returns

  • string — The List field HTML markup.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:150

get_legacy_field_input()

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

Builds the field input HTML markup.

Parameters

NameTypeDefaultDescription
$formarrayThe Form Object.
$valuestring''The field value. Defaults to empty string.
$entrynull | arraynullThe Entry Object. Defaults to null.

Returns

  • string — The List field HTML markup.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:272

get_list_input()

public function get_list_input( $has_columns, $column, $value, $form_id, $row )

Builds the input that will be inside the List field.

Parameters

NameTypeDefaultDescription
$has_columnsboolIf the input has columns.
$columnarrayThe column details.
$valuestringThe existing value of the input.
$form_idintThe form ID.
$rowintThe row number to which the input belongs.

Returns

  • string — The input HTML markup.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:455

get_field_label_class()

public function get_field_label_class()

Get field label class.

Returns

  • string

Since:

  • unknown
  • 2.5 (Added screen-reader-text if the label hasn't been set; added gfield_label_before_complex if it has choices.)
  • 2.7 (Added gform-field-label for the theme framework.)

Source: includes/fields/class-gf-field-list.php:557

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-list.php:577

get_value_submission()

public function get_value_submission( $field_values, $get_from_post_global_var=true )

Gets the value of te field from the form submission.

Parameters

NameTypeDefaultDescription
$field_valuesarrayThe properties to search for.
$get_from_post_global_varbooltrueIf the global GET variable should be used to obtain the value. Defaults to true.

Returns

  • array — The submission value.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:592

create_list_array_recursive()

public function create_list_array_recursive( $value )

Creates an array from the list items. Recurses if the field is inside a Repeater.

Parameters

NameTypeDefaultDescription
$value

Returns

  • array

Since: 2.4

Source: includes/fields/class-gf-field-list.php:607

is_value_submission_empty()

public function is_value_submission_empty( $form_id )

Check if the submission value is empty.

Parameters

NameTypeDefaultDescription
$form_idintThe form ID to check.

Returns

  • bool — True if empty. False otherwise.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:629

get_value_entry_detail()

public function get_value_entry_detail( $value, $entry=[], $use_text=false, $format='html', $media='screen' )

Gets the field value HTML markup to be used on the entry detail page.

Parameters

NameTypeDefaultDescription
$valuearrayThe submitted entry value.
$entryarray[]Not used.
$use_textboolfalseNot used.
$formatstring'html'The format to be used when building the items. Accepted values are text, url, or html. Defaults to html.
$mediastring'screen'Defines how the content will be output. Accepted values are screen or email. Defaults to screen.

Returns

  • string — The HTML markup to be displayed.

Since:

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

Source: includes/fields/class-gf-field-list.php:658

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

Source: includes/fields/class-gf-field-list.php:806

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-list.php:843

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.

By default, the List field will not be available for selection on the entry list. Use the gform_display_field_select_columns_entry_list filter to make the list field available.

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

Since: 2.4

Source: includes/fields/class-gf-field-list.php:875

create_list_array()

function create_list_array( $value )

Creates an array from the list items.

Parameters

NameTypeDefaultDescription
$valuearrayThe pre-formatted list.

Returns

  • array — The list rows.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:889

to_array()

public function to_array( $value )

Converts a string to an array.

Parameters

NameTypeDefaultDescription
$valuestringA serialized string to convert.

Returns

  • array — The converted array.

Since: 2.7.4.1

Source: includes/fields/class-gf-field-list.php:925

sanitize_settings()

public function sanitize_settings()

Sanitizes the field settings.

Since: Unknown

Source: includes/fields/class-gf-field-list.php:953

get_value_export()

public function get_value_export( $entry, $input_id='', $use_text=false, $is_csv=false )

Gets the field value, formatted for exports. For CSV export return an array.

Parameters

NameTypeDefaultDescription
$entryarrayThe Entry Object.
$input_idstring''Input ID to export. If not defined, uses the current input ID. Defaults to empty string.
$use_textboolfalseNot used. Defaults to false.
$is_csvboolfalseIs the value going to be used in the CSV export? Defaults to false.

Returns

  • string | array

Since: Unknown

Source: includes/fields/class-gf-field-list.php:979

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-list.php:1020