Class DataSource
Class DataSource
This class serves as a factory for all the resolvers for queries and mutations. This layer of abstraction over the actual resolve functions allows easier, granular control over versioning as we can change big things behind the scenes if/when needed, and we just need to ensure the call to the DataSource method returns the expected data later on. This should make it easy down the road to version resolvers if/when changes to the WordPress API are rolled out.
Methods summary
public static
WP_Comment
|
|
public static
array
|
#
resolve_comment_author( string $author_email )
Retrieves a WP_Comment object for the ID that gets passed |
public static
mixed
|
#
resolve_comments_connection( WP_Post $source, array $args,
Wrapper for the CommentsConnectionResolver class |
public static
null|array
|
|
public static
array
|
#
resolve_plugins_connection( WP_Post $source, array $args,
Wrapper for PluginsConnectionResolver::resolve |
public static
WP_Post
|
#
resolve_post_object( integer $id, string $post_type )
Returns the post object for the ID and post type passed |
public static
mixed
|
#
resolve_post_objects_connection( string $source, array $args,
Wrapper for PostObjectsConnectionResolver |
public static
WP_Post_Type
|
|
public static
WP_Taxonomy
|
#
resolve_taxonomy( string $taxonomy )
Retrieves the taxonomy object for the name of the taxonomy passed |
public static
mixed
|
|
public static
array
|
#
resolve_term_objects_connection( $source, array $args,
Wrapper for TermObjectConnectionResolver::resolve |
public static
WP_Theme
|
|
public static
array
|
#
resolve_themes_connection( $source, array $args,
Wrapper for the ThemesConnectionResolver::resolve method |
public static
GraphQL\Deferred
|
|
public static
array
|
#
resolve_users_connection( $source, array $args,
Wrapper for the UsersConnectionResolver::resolve method |
public static
array
|
#
get_setting_group_fields( string $group )
Get all of the registered settings in a WP site and return the ones that match the name of the $setting_type |
public static
array
|
#
get_allowed_setting_types( )
Get the $allowed_setting_types and filter them so that they can be further whitelisted. This method is used to build out the root query fields for the various setting types |
public static
array
|
|
public static
WP_Post|null
|
#
get_post_object_by_uri( string $uri, string $output = OBJECT, string $post_type = 'post' )
Cached version of get_page_by_path so that we're not making unnecessary SQL all the time |
Properties summary
protected static
array
|
$node_definition
Stores an array of node definitions |
|
protected static
array
|
$allowed_setting_types
Stores an array of setting types that exist in get_registered_settings. In order to register a setting with register_setting it must be categorized under one of the whitelisted group names See: https://developer.wordpress.org/reference/functions/register_setting/ |
|
protected static
array
|
$allowed_setting_groups
Stores an array of allowed setting groups. |