Skip to main content

GF_Field_Text

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

Details

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

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.
get_field_placeholder_attribute()Returns the placeholder attribute for the field.
validate()Return the result (bool) by setting $this->failed_validation.
get_text_counter_attrs()Returns the text counter attributes if maxLength is set.
get_value_merge_tag()Gets merge tag values.
get_value_entry_list()Format the entry value safe for displaying on the entry list page.
get_value_entry_detail()Format the entry value safe for displaying on the entry detail page and for the {all_fields} merge tag.
get_aria_describedby()Add the hint text to aria-describedby.
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-text.php:23

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-text.php:36

get_field_placeholder_attribute()

public function get_field_placeholder_attribute()

Returns the placeholder attribute for the field.

If no custom placeholder is set and an input mask is enabled, uses the mask as placeholder.

Returns

  • string

Since: next

Source: includes/fields/class-gf-field-text.php:76

validate()

public function validate( $value, $form )

Return the result (bool) by setting $this->failed_validation.

Return the validation message (string) by setting $this->validation_message.

Parameters

NameTypeDefaultDescription
$valuestring | arrayThe field value from get_value_submission().
$formarrayThe Form Object currently being processed.

Since: 2.4.11

Source: includes/fields/class-gf-field-text.php:93

get_text_counter_attrs()

public static function get_text_counter_attrs( $field )

Returns the text counter attributes if maxLength is set.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field object.

Returns

  • string — The text counter attributes or an empty string if text counter is not enabled.

Since: 2.9.20

Source: includes/fields/class-gf-field-text.php:173

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-text.php:227

get_value_entry_list()

public function get_value_entry_list( $value, $entry, $field_id, $columns, $form )

Format the entry value safe for displaying on the entry list page.

Parameters

NameTypeDefaultDescription
$valuestringThe 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: Unknown

Source: includes/fields/class-gf-field-text.php:268

get_value_entry_detail()

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

Format the entry value safe for displaying 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-text.php:302

get_aria_describedby()

public function get_aria_describedby( $extra_ids=[] )

Add the hint text to aria-describedby.

Parameters

NameTypeDefaultDescription
$extra_idsarray[]any extra ids that should be added to the describedby attribute.

Returns

  • string

Since: 2.5

Source: includes/fields/class-gf-field-text.php:336

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-text.php:377