Files
wp-graphql-woocommerce/includes/connection/class-posts.php
T

37 lines
741 B
PHP

<?php
/**
* Connection type - Posts
*
* Registers connections to Posts
*
* @package WPGraphQL\Extensions\WooCommerce\Connection
*/
namespace WPGraphQL\Extensions\WooCommerce\Connection;
use WPGraphQL\Connection\PostObjects;
/**
* Class - Posts
*/
class Posts extends PostObjects {
/**
* Registers the various connections from other WooCommerce Types to other WordPress post-types
*/
public static function register_connections() {
/**
* From Product to MediaItem
*/
register_graphql_connection(
self::get_connection_config(
get_post_type_object( 'attachment' ),
array(
'fromType' => 'Product',
'toType' => 'MediaItem',
'fromFieldName' => 'galleryImages',
)
)
);
}
}