| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPGraphQL\Type\ObjectType; |
| 4 |
|
| 5 |
use WPGraphQL\Registry\TypeRegistry; |
| 6 |
use WP_Post_Type; |
| 7 |
|
| 8 |
/** |
| 9 |
* @todo Remove in 3.0.0 |
| 10 |
* @deprecated 1.12.0 |
| 11 |
* @codeCoverageIgnore |
| 12 |
*/ |
| 13 |
class PostObject { |
| 14 |
/** |
| 15 |
* @todo remove in 3.0.0 |
| 16 |
* |
| 17 |
* @param \WP_Post_Type $post_type_object Post type. |
| 18 |
* @param \WPGraphQL\Registry\TypeRegistry $type_registry The Type Registry |
| 19 |
* |
| 20 |
* @return void |
| 21 |
* @throws \Exception |
| 22 |
* @deprecated 1.12.0 |
| 23 |
*/ |
| 24 |
public static function register_post_object_types( WP_Post_Type $post_type_object, TypeRegistry $type_registry ) { |
| 25 |
_doing_it_wrong( |
| 26 |
__FUNCTION__, |
| 27 |
sprintf( |
| 28 |
// translators: %s is the class name that is deprecated. |
| 29 |
esc_html__( 'This function will be removed in the next major version of WPGraphQL. Use %s instead.', 'wp-graphql' ), |
| 30 |
esc_html( \WPGraphQL\Registry\Utils\PostObject::class . '::register_types()' ), |
| 31 |
), |
| 32 |
'1.12.0' |
| 33 |
); |
| 34 |
|
| 35 |
\WPGraphQL\Registry\Utils\PostObject::register_types( $post_type_object ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* @todo remove in 3.0.0 |
| 40 |
* |
| 41 |
* @param \WP_Post_Type $post_type_object Post type. |
| 42 |
* @param \WPGraphQL\Registry\TypeRegistry $type_registry The Type Registry |
| 43 |
* |
| 44 |
* @deprecated 1.12.0 |
| 45 |
* |
| 46 |
* @return array<string,array<string,mixed>> |
| 47 |
*/ |
| 48 |
public static function get_fields( $post_type_object, $type_registry ) { |
| 49 |
_doing_it_wrong( |
| 50 |
__FUNCTION__, |
| 51 |
sprintf( |
| 52 |
// translators: %s is the class name that is deprecated. |
| 53 |
esc_html__( 'This function will be removed in the next major version of WPGraphQL. Use %s instead.', 'wp-graphql' ), |
| 54 |
esc_html( \WPGraphQL\Registry\Utils\PostObject::class . '::get_fields()' ), |
| 55 |
), |
| 56 |
'1.12.0' |
| 57 |
); |
| 58 |
|
| 59 |
return \WPGraphQL\Registry\Utils\PostObject::get_fields( $post_type_object ); |
| 60 |
} |
| 61 |
} |
| 62 |
|