From 9a726a040454d65e2a382ce169c4d564fc639ed4 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 28 Jul 2022 11:11:04 +0100 Subject: [PATCH] Add a static blockmeta data definition to the Gutenberg instance of the theme json class --- .../wordpress-6.1/class-wp-theme-json-6-1.php | 1 - lib/experimental/class-wp-theme-json-gutenberg.php | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php index e893c305e20d91..1ba51f40bc9c4a 100644 --- a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php +++ b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php @@ -15,7 +15,6 @@ * @access private */ class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 { - /** * Define which defines which pseudo selectors are enabled for * which elements. diff --git a/lib/experimental/class-wp-theme-json-gutenberg.php b/lib/experimental/class-wp-theme-json-gutenberg.php index 3d6bf949e7f835..53809cb692aa65 100644 --- a/lib/experimental/class-wp-theme-json-gutenberg.php +++ b/lib/experimental/class-wp-theme-json-gutenberg.php @@ -15,5 +15,17 @@ * @access private */ class WP_Theme_JSON_Gutenberg extends WP_Theme_JSON_6_1 { - + /** + * Holds block metadata extracted from block.json + * to be shared among all instances so we don't + * process it twice. + * + * It is necessary to redefine $blocks_metadata here so that it + * doesn't get inherited from an earlier instantiation of the + * parent class. + * + * @since 5.8.0 + * @var array + */ + protected static $blocks_metadata = null; }