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_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_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:309

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