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 / src / WPSchema.php

WPSchema.php in WPGraphQL trunk, at src/WPSchema.php

57 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPGraphQL;
4
5 use GraphQL\Type\Schema;
6 use GraphQL\Type\SchemaConfig;
7 use WPGraphQL\Registry\TypeRegistry;
8
9 /**
10 * Class WPSchema
11 *
12 * Extends the Schema to make some properties accessible via hooks/filters
13 *
14 * @package WPGraphQL
15 */
16 class WPSchema extends Schema {
17 /**
18 * {@inheritDoc}
19 *
20 * @var \GraphQL\Type\SchemaConfig
21 */
22 public $config;
23
24 /**
25 * Holds the $filterable_config which allows WordPress access to modifying the
26 * $config that gets passed down to the Executable Schema
27 *
28 * @var \GraphQL\Type\SchemaConfig
29 * @since 0.0.9
30 */
31 public $filterable_config;
32
33 /**
34 * WPSchema constructor.
35 *
36 * @param \GraphQL\Type\SchemaConfig $config The config for the Schema.
37 * @param \WPGraphQL\Registry\TypeRegistry $type_registry
38 *
39 * @since 0.0.9
40 */
41 public function __construct( SchemaConfig $config, TypeRegistry $type_registry ) {
42 $this->config = $config;
43
44 /**
45 * Set the $filterable_config as the $config that was passed to the WPSchema when instantiated
46 *
47 * @param \GraphQL\Type\SchemaConfig $config The config for the Schema.
48 * @param \WPGraphQL\Registry\TypeRegistry $type_registry The WPGraphQL type registry.
49 *
50 * @hookGroup schema-registration
51 * @since 0.0.9
52 */
53 $this->filterable_config = apply_filters( 'graphql_schema_config', $config, $type_registry );
54 parent::__construct( $this->filterable_config );
55 }
56 }
57