PluginProbe
WPGraphQL / trunk
WPGraphQL vtrunk
2.22.3 2.22.2 2.22.1 2.22.0 2.21.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.15.0 2.14.1 2.14.0 2.13.0 2.2.0 2.3.0 2.3.3 2.3.6 2.3.8 2.5.0 2.5.1 2.5.2 2.5.3 All 177 releases
wp-graphql / deprecated / PostObject.php

PostObject.php in WPGraphQL trunk, at deprecated/PostObject.php

62 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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