GravityKit\GravityMigrate\Schema\GfCreditCardInputs
Builds the six inputs GF_Field_CreditCard expects.
Gravity Forms reads this field by input position, not by searching for an id: get_value_submission() takes $this->inputs[0], [3], [4] and [5] (includes/fields/class-gf-field-creditcard.php:155-159), and the expiration date occupies positions 1 and 2 as separate month and year inputs. Six inputs, in this order.
A field with fewer is not a partial field, it is a broken one. With four inputs the two lookups past the end raise "Undefined array key" on every render and the card type and cardholder name are never read from a submission. With none, maybe_upgrade_inputs() reads $inputs[1] on a value that is not there, which warns and, when inputs is a string rather than absent, throws a TypeError from inside Gravity Forms itself.
A single-input expiration date is the pre-1.9 shape, and maybe_upgrade_inputs() rewrites it only when there are exactly five inputs. Any other count is a shape nothing upgrades and nothing renders.
Since: %ver%
Source: src/Schema/GfCreditCardInputs.php:30
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
build() | Builds the field's inputs. |
default_cards() | The card brands Gravity Forms accepts by default, matching its form editor. |
Method Reference
build()
public static function build( int $field_id ): array
Builds the field's inputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_id | int | Gravity Forms field id. |
Returns
array
Since: %ver%
Source: src/Schema/GfCreditCardInputs.php:50
default_cards()
public static function default_cards(): array
The card brands Gravity Forms accepts by default, matching its form editor.
Returns
array
Since: %ver%
Source: src/Schema/GfCreditCardInputs.php:86