-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvip-decoupled.php
93 lines (80 loc) · 2.16 KB
/
vip-decoupled.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* Plugin Name: VIP Decoupled Plugin Bundle
* Plugin URI: https://github.com/Automattic/vip-decoupled-bundle
* Description: Plugin bundle to quickly provide a decoupled WordPress setup.
* Author: WordPress VIP
* Text Domain: vip-decoupled-bundle
* Version: 1.2.3
* Requires at least: 5.9.0
* Tested up to: 6.7.0
* Requires PHP: 7.4
* License: GPL-3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package vip-bundle-decoupled
*/
namespace WPCOMVIP\Decoupled;
use function WPCOMVIP\Decoupled\Settings\is_plugin_enabled;
/**
* Admin UI and helpers.
*/
require_once __DIR__ . '/admin/admin.php';
/**
* Enable settings.
*/
require_once __DIR__ . '/settings/settings.php';
/**
* WPGraphQL 1.19.0.
*/
if ( is_plugin_enabled( 'wpgraphql' ) ) {
require_once __DIR__ . '/lib/wp-graphql/wp-graphql.php';
}
/**
* Make Gutenberg blocks available in WPGraphQL.
*/
if ( is_plugin_enabled( 'blocks' ) ) {
require_once __DIR__ . '/blocks/blocks.php';
}
/**
* VIP Block Data API.
*/
if ( is_plugin_enabled( 'block-data-api' ) ) {
require_once __DIR__ . '/lib/vip-block-data-api/vip-block-data-api.php';
}
/**
* Adjust CORS headers.
*/
require_once __DIR__ . '/cors/cors.php';
/**
* Enable decoupled previews.
*/
if ( is_plugin_enabled( 'preview' ) ) {
require_once __DIR__ . '/preview/preview.php';
}
/**
* Automatic type registration.
*/
if ( is_plugin_enabled( 'registration' ) ) {
require_once __DIR__ . '/registration/registration.php';
}
/**
* Adjust resource URLs.
*/
require_once __DIR__ . '/urls/urls.php';
/**
* Force-enable schema introspection. If schema introspection is disabled, code
* generation and, therefore, the Next.js build will fail.
*
* @param string $value The current value of the setting.
* @param string $default The default value of the setting.
* @param string $option_name The setting name.
* @return string
*/
function force_enable_schema_introspection( $value, $default, $option_name ) {
if ( 'public_introspection_enabled' === $option_name ) {
return 'on';
}
return $value;
}
add_filter( 'graphql_get_setting_section_field_value', __NAMESPACE__ . '\\force_enable_schema_introspection', 10, 3 );