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
| Property | Type | Description |
|---|---|---|
$type | string | The field type. |
Methods
| Method | Description |
|---|---|
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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object. | |
$value | string | '' | The field value. Defaults to empty string. |
$entry | null | array | null | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object. | |
$value | string | '' | The field value. Defaults to empty string. |
$entry | null | array | null | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$has_columns | bool | If the input has columns. | |
$column | array | The column details. | |
$value | string | The existing value of the input. | |
$form_id | int | The form ID. | |
$row | int | The 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:
unknown2.5(Addedscreen-reader-textif the label hasn't been set; addedgfield_label_before_complexif it has choices.)2.7(Addedgform-field-labelfor 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
| Name | Type | Default | Description |
|---|---|---|---|
$field_values | array | The properties to search for. | |
$get_from_post_global_var | bool | true | If 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
| Name | Type | Default | Description |
|---|---|---|---|
$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
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | The submitted entry value. | |
$entry | array | [] | Not used. |
$use_text | bool | false | Not used. |
$format | string | 'html' | The format to be used when building the items. Accepted values are text, url, or html. Defaults to html. |
$media | string | '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:
Unknown2.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
| 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-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
| 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-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
| 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: 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
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | A 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
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The Entry Object. | |
$input_id | string | '' | Input ID to export. If not defined, uses the current input ID. Defaults to empty string. |
$use_text | bool | false | Not used. Defaults to false. |
$is_csv | bool | false | Is 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