GravityKit\GravityMigrate\Exporters\Controller
Handles AJAX endpoints for exporting Gravity Forms to third-party providers.
Since: %ver%
Source: src/Exporters/Controller.php:29
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Exporters
Properties
| Property | Type | Description |
|---|---|---|
$registry | TargetRegistry | Exporter registry. |
$util | Util | Utility helper. |
Methods
| Method | Description |
|---|---|
__construct() | Controller constructor. |
register_routes() | Registers controller routes with GravityKit Foundation. |
list_exporters() | Returns available exporters. |
list_forms() | Returns Gravity Forms forms for export. |
analyze_forms() | Analyses several forms in one request. |
analyze_form() | Analyses a form for export. |
map_by_label() | Pairs of label and value as a map, dropping any label that names two different values. |
export_form() | Exports a form to a provider. |
Method Reference
__construct()
public function __construct( TargetRegistry $registry )
Controller constructor.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$registry | TargetRegistry | Exporter registry instance. |
Since: %ver%
Source: src/Exporters/Controller.php:90
register_routes()
public function register_routes( $routes ): array
Registers controller routes with GravityKit Foundation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$routes | array | Existing routes. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:106
list_exporters()
public function list_exporters( $payload ): array
Returns available exporters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload | array | Request payload. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:123
list_forms()
public function list_forms( $payload ): array
Returns Gravity Forms forms for export.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload | array | Request payload. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:170
analyze_forms()
public function analyze_forms( $payload ): array
Analyses several forms in one request.
The Forms step asks what each form loses on the way across, and asked once per form: a site with a hundred forms paid for a hundred WordPress boots to do a few milliseconds of work each. Everything expensive -- validating the request, resolving the provider, fetching the exporter -- happens once here for the whole set.
A form that cannot be read is reported against its own id rather than thrown, because the screen marks one card per form: a batch that failed whole would blank a screenful of answers over one bad form. Only failures that apply to every id equally -- a bad nonce, a missing capability, an unavailable exporter -- refuse the request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload | array | Request payload. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:276
analyze_form()
public function analyze_form( $payload ): array
Analyses a form for export.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload | array | Request payload. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:348
map_by_label()
public static function map_by_label( array $pairs ): array
Pairs of label and value as a map, dropping any label that names two different values.
The export report describes fields by label, and labels are not unique. Where two fields share one, saying either value beside the other states something false, so the label is dropped and the row is left plain.
Three walks over the same form build maps this way and only one of them did it: the readable type dropped an ambiguous label while the universal type kept whichever field came last, so a verdict could be computed from another field's type and a row read "Stays the same" about a field that had changed. One rule here, so they cannot drift apart again.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$pairs | array |
Returns
array<string,— string>
Since: %ver%
Source: src/Exporters/Controller.php:445
export_form()
public function export_form( $payload ): array
Exports a form to a provider.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload | array | Request payload. |
Returns
array
Since: %ver%
Source: src/Exporters/Controller.php:693