GF_Field_Calculation
Source: includes/fields/class-gf-field-calculation.php:8
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$_supports_state_validation | bool | Indicates if this field supports state validation. |
Methods
| Method | Description |
|---|---|
get_field_input() | Get the field inputs. |
get_field_label() | Retrieve the field label. |
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_values_for_state_hash() | Prepares the value that will be hashed on form display as part of the state. |
get_state_validation_message() | Returns the validation message to be applied when the field has failed state validation. |
Method Reference
get_field_input()
public function get_field_input( $form, $value='', $entry=null )
Get the field inputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The form object. | |
$value | string | '' | The field value. |
$entry | array | null | The entry object. |
Returns
string
Since:
unknown2.5(Add accessibility enhancements.)
Source: includes/fields/class-gf-field-calculation.php:60
get_field_label()
public function get_field_label( $force_frontend_label=true, $value='' )
Retrieve the field label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$force_frontend_label | bool | true | Should the frontend label be displayed in the admin even if an admin label is configured. |
$value | string | '' | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
Returns
string
Since:
2.53.0(Made the params optional.)
Source: includes/fields/class-gf-field-calculation.php:135
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
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. | |
$entry | array | [] | The entry. |
$use_text | bool | false | false | When processing choice based fields should the choice text be returned instead of the value. |
$format | string | 'html' | The format requested for the location the merge is being used. Possible values: html, text or url. |
$media | string | 'screen' | The location where the value will be displayed. Possible values: screen or email. |
Returns
string
Since:
1.92.9.29(Changed the second parameter $currency (string) to $entry (array).)
Source: includes/fields/class-gf-field-calculation.php:167
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
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | The value to be saved. | |
$form | array | The Form object currently being processed. | |
$input_name | string | The input name used when accessing the $_POST. | |
$entry_id | int | The ID of the entry currently being processed. | |
$entry | array | The entry currently being processed. | |
$repeater_index | string | '' | 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-calculation.php:195
get_values_for_state_hash()
public function get_values_for_state_hash( $value )
Prepares the value that will be hashed on form display as part of the state.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The default value. |
Returns
null|array
Since: 3.0
Source: includes/fields/class-gf-field-calculation.php:221
get_state_validation_message()
public function get_state_validation_message()
Returns the validation message to be applied when the field has failed state validation.
Returns
string
Since: 3.0
Source: includes/fields/class-gf-field-calculation.php:236