Skip to main content

GF_Field_Total

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

Details

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

Methods

MethodDescription
get_form_editor_field_icon()Returns the field's form editor icon.
get_field_container()Returns the HTML markup for the field's containing element.
get_value_entry_detail()Format the entry value for display on the entry detail page and for the {all_fields} merge tag.
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.
validate()Validates the field value.
post_convert_field()Actions to be performed after the field has been converted to an object.
sanitize_settings()Sanitizes the field properties.

Method Reference

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-total.php:38

get_field_container()

public function get_field_container( $atts, $form )

Returns the HTML markup for the field's containing element.

Parameters

NameTypeDefaultDescription
$attsarrayContainer attributes.
$formarrayThe current Form object.

Returns

  • string

Since: 2.5

Source: includes/fields/class-gf-field-total.php:52

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-total.php:101

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.

For total fields inside a repeater, the value is scoped to only the products within that repeater level (and nested repeaters), excluding shipping.

For top-level total fields, the value includes all products in the form (including those inside repeaters) plus shipping.

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-total.php:125

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-total.php:159

validate()

public function validate( $value, $form )

Validates the field value.

Parameters

NameTypeDefaultDescription
$valuestringThe submitted value.
$formarrayThe form currently being validated.

Returns

  • void

Since: 2.8.2

Source: includes/fields/class-gf-field-total.php:177

post_convert_field()

public function post_convert_field()

Actions to be performed after the field has been converted to an object.

Returns

  • void

Since: 3.0 (Enabled total validation for existing fields.)

Source: includes/fields/class-gf-field-total.php:222

sanitize_settings()

public function sanitize_settings()

Sanitizes the field properties.

Returns

  • void

Since: 2.8.2

Source: includes/fields/class-gf-field-total.php:236