Skip to content

Commit de8beb6

Browse files
authored
feat!: implement FormField model, dataloader, and ConnectionResolver (#416)
* feat!: implement FormField model, dataloader, and ConnectionResolver * fix: implement `Node` interface on `FormField` * chore: add changelog
1 parent 2be7e1e commit de8beb6

33 files changed

+1043
-336
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased]
44

5+
- feat!: Implement `FormField` model and `DataLoader`, and refactor `FormFieldsConnectionResolver` to extend `AbstractConnectionResolver`.
56
- feat!: Refactor `FormsConnectionResolver` and `EntriesConnectionResolver` for compatibility with WPGraphQL v1.26.0 improvements.
67
- feat!: Narrow `FormField.choices` and `FormField.inputs` field types to their implementations.
78
- chore!: Bump minimum WPGraphQL version to v1.26.0.

composer.lock

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/querying-entries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Entries that include [Pricing Fields](https://docs.gravityforms.com/category/use
8888
name
8989
price
9090
options {
91-
connectedFormField{
91+
connectedFormField {
9292
... on OptionCheckboxField {
9393
databaseId
9494
}

src/CoreSchemaFilters.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,5 @@ public static function register_hooks(): void {
2929

3030
// Change max query amount for form fields.
3131
add_filter( 'graphql_connection_max_query_amount', [ Factory::class, 'set_max_query_amount' ], 11, 5 );
32-
33-
// Strip `Connection` interface from form fields.
34-
add_filter( 'graphql_type_interfaces', [ self::class, 'strip_connection_interface_from_gf_fields' ], 10, 2 );
35-
}
36-
37-
/**
38-
* Strip `Connection` interface from form fields.
39-
*
40-
* @param string[] $interfaces Array of interfaces.
41-
* @param array<string,mixed> $config The type config.
42-
*
43-
* @return string[]
44-
*/
45-
public static function strip_connection_interface_from_gf_fields( array $interfaces, array $config ): array {
46-
// Bail early if Connection, 'Edge, or 'OneToOneConnection' arent in the interfaces.
47-
if ( ! in_array( 'Connection', $interfaces, true ) && ! in_array( 'Edge', $interfaces, true ) && ! in_array( 'OneToOneConnection', $interfaces, true ) ) {
48-
return $interfaces;
49-
}
50-
51-
// If the config name contains `FormFieldConnection`, remove the `Connection` interface.
52-
if ( false !== strpos( $config['name'], 'FormFieldConnection' ) || false !== strpos( $config['name'], 'QuizFieldConnection' ) ) {
53-
$interfaces = array_filter(
54-
$interfaces,
55-
static function ( $interface_name ) {
56-
return ! in_array( $interface_name, [ 'Connection', 'Edge', 'OneToOneConnection' ], true );
57-
}
58-
);
59-
}
60-
61-
return $interfaces;
6232
}
6333
}

0 commit comments

Comments
 (0)