GravityKit\GravityMigrate\Importers\ImportVerifier
Compares the form that was requested against the form Gravity Forms stored.
Gravity Forms has no structural validator. GFAPI::validate_form() validates a submission's field values rather than the form object, and GFAPI::add_form() says of itself that "little checking is done to make sure it's a valid Form object". What does run on save is GFFormsModel::sanitize_settings(), which whitelists values, coerces types and calls each field's own sanitize_settings(), all silently.
So a form can be accepted, reported as a success, and still not be the form that was asked for: Gravity Forms re-keys notifications by id, so two without ids collapse onto one, and a field's array of allowed file extensions can be coerced to the string "Array".
Since: %ver%
Source: src/Importers/ImportVerifier.php:25
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Importers
Methods
| Method | Description |
|---|---|
compare() | Compares a requested form against the stored one. |
Method Reference
compare()
public static function compare( array $requested, array $stored ): array
Compares a requested form against the stored one.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$requested | array | Form array handed to GFAPI::add_form(). | |
$stored | array | Form array read back with GFAPI::get_form(). |
Returns
string[]— Human-readable discrepancies; empty when the form stored faithfully.
Since: %ver%
Source: src/Importers/ImportVerifier.php:37