GravityKit\GravityMigrate\Schema\GfLocationLists
Supplies the lists a country or state dropdown needs when the source form does not carry one.
Ninja Forms does not store these. A Country or State field keeps the placeholder options every list field is created with -- One, Two, Three -- and the real list is injected when the page renders, through ninja_forms_render_options_listcountry (Fields/ListCountry.php:38,111-118); the seeding of the stored options is commented out in its constructor (:25). Read literally, the stored options make a migrated form ask people to choose between One, Two and Three.
The lists are read off the Gravity Forms address field, which is the list the visitor sees once the form is imported.
Since: %ver%
Source: src/Schema/GfLocationLists.php:26
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
is_placeholder() | Whether a set of choices is the untouched placeholder rather than a list somebody wrote. |
countries() | The countries a dropdown should offer, as Gravity Forms choices. |
states() | The states a dropdown should offer, as Gravity Forms choices. |
states_for_address() | The states one address field's own type offers, as Gravity Forms choices. |
Method Reference
is_placeholder()
public static function is_placeholder( array $choices ): bool
Whether a set of choices is the untouched placeholder rather than a list somebody wrote.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$choices | array | Gravity Forms choices. |
Returns
bool— True when the set is empty, or every label in it is one of the placeholders.
Since: %ver%
Source: src/Schema/GfLocationLists.php:46
countries()
public static function countries(): array
The countries a dropdown should offer, as Gravity Forms choices.
Returns
array
Since: %ver%
Source: src/Schema/GfLocationLists.php:73
states()
public static function states(): array
The states a dropdown should offer, as Gravity Forms choices.
Returns
array
Since: %ver%
Source: src/Schema/GfLocationLists.php:84
states_for_address()
public static function states_for_address( array $field ): array
The states one address field's own type offers, as Gravity Forms choices.
An address that named a type carries that type's list -- "Canadian" offers provinces, and
a type a site added through gform_address_types offers whatever it named. Only a type
with no list of its own falls back to the states, which is what the Ninja Forms field is
named for.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | Gravity Forms address field. |
Returns
array
Since: %ver%
Source: src/Schema/GfLocationLists.php:102