Skip to main content

GF_Field_CreditCard

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

Details

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

Properties

PropertyTypeDescription
$duplicatableboolWhether there can be more than one of this field type per form.
$repeatableboolWhether the field can be used in a repeater.
$is_paymentboolIndicates the field is used to capture payments.

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.
get_required_inputs_ids()Defines the IDs of required inputs.
get_inputs_describedby_attributes()Generates an array that contains aria-describedby attribute for each input.
get_field_container_tag()Returns the HTML tag for the field container.
get_field_content()Displays an insecure page warning below the field content.
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.
post_convert_field()Upgrades inputs, if needed.
maybe_upgrade_inputs()GF1.8 and earlier used 5 inputs (1 input for the expiration date); GF1.9 changed to 6 inputs (the expiration month and year now separate); upgrade those fields still using the older configuration.

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-creditcard.php:50

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-creditcard.php:63

get_required_inputs_ids()

public function get_required_inputs_ids()

Defines the IDs of required inputs.

Returns

  • string[]

Since: 2.5

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

get_inputs_describedby_attributes()

public function get_inputs_describedby_attributes( $required_inputs_ids, $values )

Generates an array that contains aria-describedby attribute for each input.

Depending on each input's validation state, aria-describedby takes the value of the validation message container ID, the description only or nothing.

Parameters

NameTypeDefaultDescription
$required_inputs_idsarrayIDs of required field inputs.
$valuesarray | stringInputs values.

Returns

  • array

Since: 2.5

Source: includes/fields/class-gf-field-creditcard.php:114

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

Source: includes/fields/class-gf-field-creditcard.php:194

get_field_content()

public function get_field_content( $value, $force_frontend_label, $form )

Displays an insecure page warning below the field content.

Parameters

NameTypeDefaultDescription
$valuestring | arrayThe field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
$force_frontend_labelboolShould the frontend label be displayed in the admin even if an admin label is configured.
$formarrayThe Form Object currently being processed.

Returns

  • string

Since: 2.5

Source: includes/fields/class-gf-field-creditcard.php:215

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-creditcard.php:539

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-creditcard.php:612

post_convert_field()

public function post_convert_field()

Upgrades inputs, if needed.

Returns

  • void

See Also

Since: 2.1.2.7

Source: includes/fields/class-gf-field-creditcard.php:648

maybe_upgrade_inputs()

public function maybe_upgrade_inputs()

GF1.8 and earlier used 5 inputs (1 input for the expiration date); GF1.9 changed to 6 inputs (the expiration month and year now separate); upgrade those fields still using the older configuration.

Source: includes/fields/class-gf-field-creditcard.php:656