Skip to main content

GF_Field_Number

Source: includes/fields/class-gf-field-number.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.
clean_value()Ensures the POST value is in the correct number format.
is_value_empty()Is the given value considered empty for this field.
get_value_entry_detail()Format the entry value for display on the entry detail page and for the {all_fields} merge tag.
get_value_merge_tag()Gets merge tag values.
get_value_save_input()Sanitize and format the value before it is saved to the Entry Object.

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

clean_value()

public function clean_value( $value )

Ensures the POST value is in the correct number format.

Parameters

NameTypeDefaultDescription
$value

Returns

  • bool | float | string

Since: 2.4

Source: includes/fields/class-gf-field-number.php:98

is_value_empty()

public function is_value_empty( $value )

Is the given value considered empty for this field.

Adds a check to the parent method because a value of 0 returns a false positive.

Parameters

NameTypeDefaultDescription
$value

Returns

  • bool

Since: 2.7.1

Source: includes/fields/class-gf-field-number.php:151

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-number.php:296

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-number.php:323

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-number.php:355