Skip to main content

GF_Field_Phone

Class GF_Field_Phone

Handles the behavior of Phone fields.

Since: Unknown

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

Details

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

Properties

PropertyTypeDescription
$typestringThe field type.

Methods

MethodDescription
get_form_editor_field_title()Defines the field title to be used 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 within the field editor.
is_conditional_logic_supported()Defines if conditional logic is supported in this field type.
get_field_placeholder_attribute()Returns the placeholder attribute for the field.
get_field_container_tag()Returns the HTML tag for the field container.
validate()Validates inputs for the Phone field.
get_field_css_class()Get field CSS class.
get_field_input()Returns the field input.
get_value_submission()Gets the value of the submitted field.
sanitize_entry_value()Sanitizes the entry value.
get_value_save_input()Sanitize and format the value before it is saved to the Entry Object.
get_value_entry_detail()Gets the value to be displayed on the entry detail page.
get_value_entry_list()Gets the value to be displayed on the entries list page.
get_value_merge_tag()Gets the merge tag value.
get_value_export()Gets the value to be used when exporting the entry.
sanitize_settings()Sanitizes the field settings.
get_phone_formats()Get an array of phone formats.
get_phone_format()Get the properties for the fields selected phone format.

Method Reference

get_form_editor_field_title()

public function get_form_editor_field_title()

Defines the field title to be used in the form editor.

Returns

  • string — The field title. Translatable and escaped.

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:37

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-phone.php:48

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-phone.php:61

get_form_editor_field_settings()

function get_form_editor_field_settings()

Defines the field settings available within the field editor.

Returns

  • array — The field settings available for the field.

Since: Unknown

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

is_conditional_logic_supported()

public function is_conditional_logic_supported()

Defines if conditional logic is supported in this field type.

Returns

  • bool — true

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:109

get_field_placeholder_attribute()

public function get_field_placeholder_attribute()

Returns the placeholder attribute for the field.

If no custom placeholder is set and the phone format has a mask, uses the mask as placeholder.

Returns

  • string

Since: next

Source: includes/fields/class-gf-field-phone.php:122

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

Source: includes/fields/class-gf-field-phone.php:142

validate()

public function validate( $value, $form )

Validates inputs for the Phone field.

Parameters

NameTypeDefaultDescription
$valuearray | stringThe field value to be validated.
$formarrayThe Form Object.

Returns

  • void

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:172

get_field_css_class()

public function get_field_css_class()

Get field CSS class.

Returns

  • string

Source: includes/fields/class-gf-field-phone.php:232

get_field_input()

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

Returns the field input.

Parameters

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

Returns

  • string — The HTML markup for the field.

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:257

get_value_submission()

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

Gets the value of the submitted field.

Parameters

NameTypeDefaultDescription
$field_valuesarrayThe dynamic population parameter names with their corresponding values to be populated.
$get_from_post_global_varbooltrueWhether to get the value from the $_POST array as opposed to $field_values. Defaults to true.

Returns

  • array | string

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:585

sanitize_entry_value()

public function sanitize_entry_value( $value, $form_id )

Sanitizes the entry value.

Parameters

NameTypeDefaultDescription
$valuestringThe value to be sanitized.
$form_idintThe form ID of the submitted item.

Returns

  • array | array[] | string[] — The sanitized value.

Since: Unknown

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

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-phone.php:634

get_value_entry_detail()

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

Gets the value to be displayed on the entry detail page.

Parameters

NameTypeDefaultDescription
$valuestringThe field value.
$currencystring''The entry currency code.
$use_textboolfalseWhen processing merge tags, etc.
$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.

Returns

  • string

Source: includes/fields/class-gf-field-phone.php:701

get_value_entry_list()

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

Gets the value to be displayed on the entries list page.

Parameters

NameTypeDefaultDescription
$valuestringThe field value.
$entryarrayThe Entry Object.
$field_idstringThe field ID.
$columnsarrayThe columns to be displayed.
$formarrayThe Form Object.

Returns

  • string

Source: includes/fields/class-gf-field-phone.php:729

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 the merge tag value.

Parameters

NameTypeDefaultDescription
$valuestringThe merge tag value to be filtered.
$input_idstringThe field or input ID from the merge tag.
$entryarrayThe Entry Object.
$formarrayThe Form Object.
$modifierstringThe merge tag modifier.
$raw_valuestringThe raw field value from before formatting.
$url_encodeboolWhether to encode the value for URLs.
$esc_htmlboolWhether to encode HTML entities.
$formatstringThe format requested for the location the merge is being used.
$nl2brboolWhether to convert newlines to HTML line breaks.

Returns

  • string

Source: includes/fields/class-gf-field-phone.php:759

get_value_export()

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

Gets the value to be used when exporting the entry.

Parameters

NameTypeDefaultDescription
$entryarrayThe Entry Object.
$input_idstring''The field or input ID.
$use_textboolfalseWhether to use the text value.
$is_csvboolfalseWhether the export is for CSV.

Returns

  • string

Source: includes/fields/class-gf-field-phone.php:790

sanitize_settings()

public function sanitize_settings()

Sanitizes the field settings.

Returns

  • void

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:821

get_phone_formats()

public function get_phone_formats( $form_id=null )

Get an array of phone formats.

Parameters

NameTypeDefaultDescription
$form_idnull | intnullThe ID of the current form or null to use the value from the current fields form_id property. Defaults to null.

Returns

  • array — The phone formats available.

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:845

get_phone_format()

public function get_phone_format()

Get the properties for the fields selected phone format.

Returns

  • array — The phone format.

Since: Unknown

Source: includes/fields/class-gf-field-phone.php:898