GravityKit\GravityMigrate\Schema\GfChoiceInputs
Numbers the inputs of a multi-choice Gravity Forms field.
Gravity Forms never issues a choice number divisible by ten, because an input id is
handled as a float in places and 5.10 collapses onto 5.1: the tenth choice would
then collide with the first in conditional logic, calculations, merge tags and entry
meta. GF_Field_Checkbox skips those numbers when it builds inputs, so anything that
generates input ids for an imported field has to skip them the same way.
Choice numbers therefore run 1-9, 11-19, 21-29, and so on.
Since: %ver%
Source: src/Schema/GfChoiceInputs.php:23
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
next_choice_number() | Returns the next usable choice number, skipping multiples of ten. |
input_id() | Returns the input id for the nth choice of a field. |
choice_number_for_index() | Returns the choice number Gravity Forms would give the nth choice. |
Method Reference
next_choice_number()
public static function next_choice_number( int $choice_number ): int
Returns the next usable choice number, skipping multiples of ten.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$choice_number | int | Running choice counter, passed through this before each use. |
Returns
int— The counter unchanged, or the next number up when it lands on a multiple of ten. Anything below 1 resolves to 1.
Since: %ver%
Source: src/Schema/GfChoiceInputs.php:35
input_id()
public static function input_id( int $field_id, int $index ): string
Returns the input id for the nth choice of a field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_id | int | Gravity Forms field id. | |
$index | int | Zero-based choice index. |
Returns
string
Since: %ver%
Source: src/Schema/GfChoiceInputs.php:57
choice_number_for_index()
public static function choice_number_for_index( int $index ): int
Returns the choice number Gravity Forms would give the nth choice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$index | int | Zero-based choice index. |
Returns
int
Since: %ver%
Source: src/Schema/GfChoiceInputs.php:70