Class PostObjectConnectionResolver
Class PostObjectConnection - connects posts to other types
- WPGraphQL\Data\ConnectionResolver implements WPGraphQL\Data\ConnectionResolverInterface
-
WPGraphQL\Type\PostObject\Connection\PostObjectConnectionResolver
Package: WPGraphQL\Data\Resolvers
Since: 0.0.5
Located at Type/PostObject/Connection/PostObjectConnectionResolver.php
Methods summary
public
|
|
public static
array
|
#
get_query_args( mixed $source, array $args,
This returns the $query_args that should be used when querying for posts in the postObjectConnectionResolver. This checks what input $args are part of the query, combines them with various filters, etc and returns an array of $query_args to be used in the \WP_Query call |
public static
WP_Query
|
|
public static
array
|
#
get_connection( mixed $query, array $items, array $source, array $args,
This takes an array of items, the $args and the $query and returns the connection including the edges and page info |
public static
array
|
|
public static
array
|
#
sanitize_input_fields( array $args, mixed $source, array $all_args,
This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Query friendly keys. There's probably a cleaner/more dynamic way to approach this, but this was quick. I'd be down to explore more dynamic ways to map this, but for now this gets the job done. |
Methods inherited from WPGraphQL\Data\ConnectionResolver
get_amount_requested()
,
get_array_meta()
,
get_array_slice()
,
get_offset()
,
get_query_amount()
,
get_query_info()
,
resolve()
Properties summary
public static
|
$post_type
Stores the name of the $post_type being resolved |
|
public static
integer
|
$max_query_amount
Holds the maximum number of items that can be queried per request |
#
100
|