Skip to content

Commit

Permalink
Merge pull request #5 from jasonbahl/feat/post-object-connection-reso…
Browse files Browse the repository at this point in the history
…lver-filters/update-filters-2

feat: pass unfiltered args as arguments on filters
  • Loading branch information
jasonbahl authored Dec 6, 2022
2 parents e256f52 + 6861036 commit 8567f3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
7 changes: 2 additions & 5 deletions src/Data/Connection/AbstractConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,11 @@ public function __construct( $source, array $args, AppContext $context, ResolveI
*
* @param array $args The GraphQL args passed to the resolver.
* @param AbstractConnectionResolver $connection_resolver Instance of the ConnectionResolver.
* @param mixed $source Source passed down from the resolve tree.
* @param array $all_args Array of arguments input in the field as part of the GraphQL query.
* @param AppContext $context Object containing app context that gets passed down the resolve tree.
* @param ResolveInfo $info Info about fields passed down the resolve tree.
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
*
* @since 1.11.0
*/
$this->args = apply_filters( 'graphql_connection_args', $this->get_args(), $this, $this->source, $this->args, $this->context, $this->info );
$this->args = apply_filters( 'graphql_connection_args', $this->get_args(), $this, $args );

/**
* Determine the query amount for the resolver.
Expand Down
9 changes: 3 additions & 6 deletions src/Data/Connection/MenuItemConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,12 @@ public function get_args(): array {
*
* Filters the GraphQL args before they are used in get_query_args().
*
* @param array $args The GraphQL args passed to the resolver.
* @param mixed $source Source passed down from the resolve tree.
* @param array $all_args Array of arguments input in the field as part of the GraphQL query.
* @param AppContext $context Object containing app context that gets passed down the resolve tree.
* @param ResolveInfo $info Info about fields passed down the resolve tree.
* @param array $args The GraphQL args passed to the resolver.
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
*
* @since 1.11.0
*/
return apply_filters( 'graphql_menu_item_connection_args', $args, $this->source, $this->args, $this->context, $this->info );
return apply_filters( 'graphql_menu_item_connection_args', $args, $this->args );
}

}
7 changes: 2 additions & 5 deletions src/Data/Connection/PostObjectConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,11 @@ public function get_args(): array {
*
* @param array $args The GraphQL args passed to the resolver.
* @param PostObjectConnectionResolver $connection_resolver Instance of the ConnectionResolver.
* @param mixed $source Source passed down from the resolve tree.
* @param array $all_args Array of arguments input in the field as part of the GraphQL query.
* @param AppContext $context Object containing app context that gets passed down the resolve tree.
* @param ResolveInfo $info Info about fields passed down the resolve tree.
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
*
* @since 1.11.0
*/
return apply_filters( 'graphql_post_object_connection_args', $args, $this, $this->source, $this->args, $this->context, $this->info );
return apply_filters( 'graphql_post_object_connection_args', $args, $this, $this->args );
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Data/Connection/TermObjectConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,13 @@ public function get_args(): array {
*
* Filters the GraphQL args before they are used in get_query_args().
*
* @param array $args The GraphQL args passed to the resolver.
* @param array $args The GraphQL args passed to the resolver.
* @param TermObjectConnectionResolver $connection_resolver Instance of the ConnectionResolver
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
*
* @since 1.11.0
*/
return apply_filters( 'graphql_term_object_connection_args', $args, $this );
return apply_filters( 'graphql_term_object_connection_args', $args, $this, $this->args );
}

/**
Expand Down

0 comments on commit 8567f3c

Please sign in to comment.