From 98f71c0b2a29370a544f5274fc8471c7ac7631c1 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 13 Feb 2024 15:03:50 +0000 Subject: [PATCH 1/4] Pass parent post type as per extended class constructor --- lib/compat/wordpress-6.5/rest-api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.5/rest-api.php b/lib/compat/wordpress-6.5/rest-api.php index 12d789fb58b869..835a67055d9185 100644 --- a/lib/compat/wordpress-6.5/rest-api.php +++ b/lib/compat/wordpress-6.5/rest-api.php @@ -14,7 +14,7 @@ * Registers the Global Styles Revisions REST API routes. */ function gutenberg_register_global_styles_revisions_endpoints() { - $global_styles_revisions_controller = new Gutenberg_REST_Global_Styles_Revisions_Controller_6_5(); + $global_styles_revisions_controller = new Gutenberg_REST_Global_Styles_Revisions_Controller_6_5( 'wp_global_styles' ); $global_styles_revisions_controller->register_routes(); } From 5b4472875279f6329afb69ebc6a2dd57ed81b6f9 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 13 Feb 2024 15:04:20 +0000 Subject: [PATCH 2/4] Define parent post type property to align with extended classes --- ...-gutenberg-rest-global-styles-revisions-controller-6-4.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php index 4c7df97c33e57c..6aa1a854a6ad71 100644 --- a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php +++ b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php @@ -15,6 +15,10 @@ * @see WP_REST_Controller */ class Gutenberg_REST_Global_Styles_Revisions_Controller_6_4 extends WP_REST_Global_Styles_Revisions_Controller { + + + private $parent_post_type; + /** * Prepares the revision for the REST response. * From 31adb2c66f199fa9c84c74eb26cefafe63310d42 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 13 Feb 2024 15:14:14 +0000 Subject: [PATCH 3/4] Set property on 6.4 class --- ...ss-gutenberg-rest-global-styles-revisions-controller-6-4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php index 6aa1a854a6ad71..81c54150b7c9fe 100644 --- a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php +++ b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php @@ -17,7 +17,7 @@ class Gutenberg_REST_Global_Styles_Revisions_Controller_6_4 extends WP_REST_Global_Styles_Revisions_Controller { - private $parent_post_type; + protected $parent_post_type = 'wp_global_styles'; /** * Prepares the revision for the REST response. From 5773a8c7f9fca4e39e2931dafbc445c74f839434 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 13 Feb 2024 15:20:37 +0000 Subject: [PATCH 4/4] Simplify --- ...ss-gutenberg-rest-global-styles-revisions-controller-6-4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php index 81c54150b7c9fe..277143523b1894 100644 --- a/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php +++ b/lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php @@ -17,7 +17,7 @@ class Gutenberg_REST_Global_Styles_Revisions_Controller_6_4 extends WP_REST_Global_Styles_Revisions_Controller { - protected $parent_post_type = 'wp_global_styles'; + protected $parent_post_type; /** * Prepares the revision for the REST response.