2019-03-31 23:16:11 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Connection type - Posts
|
|
|
|
|
*
|
|
|
|
|
* Registers connections to Posts
|
|
|
|
|
*
|
2019-10-25 19:13:36 -04:00
|
|
|
* @package WPGraphQL\WooCommerce\Connection
|
2019-03-31 23:16:11 -04:00
|
|
|
*/
|
|
|
|
|
|
2019-10-25 19:13:36 -04:00
|
|
|
namespace WPGraphQL\WooCommerce\Connection;
|
2019-03-31 23:16:11 -04:00
|
|
|
|
|
|
|
|
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() {
|
2019-10-24 22:11:04 -04:00
|
|
|
register_graphql_connection(
|
|
|
|
|
self::get_connection_config(
|
|
|
|
|
get_post_type_object( 'attachment' ),
|
|
|
|
|
array(
|
|
|
|
|
'fromType' => 'Product',
|
|
|
|
|
'toType' => 'MediaItem',
|
|
|
|
|
'fromFieldName' => 'galleryImages',
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
2019-03-31 23:16:11 -04:00
|
|
|
}
|
|
|
|
|
}
|