mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
37 lines
741 B
PHP
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',
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|