From 43744abd20eee7e79ceffcc4dedd6d7f30977d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Thu, 8 Jul 2021 19:12:23 +0200 Subject: [PATCH 1/2] Be strict about what settings can be part of layout --- lib/class-wp-theme-json-gutenberg.php | 5 ++++- phpunit/class-wp-theme-json-test.php | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 92bd630ad2fffa..0b4ae918037a14 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -92,7 +92,10 @@ class WP_Theme_JSON_Gutenberg { 'palette' => null, ), 'custom' => null, - 'layout' => null, + 'layout' => array( + 'contentSize' => null, + 'wideSize' => null, + ), 'spacing' => array( 'customMargin' => null, 'customPadding' => null, diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index 91974e8ef6b480..e6398f6930271c 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -16,6 +16,10 @@ function test_get_settings() { 'color' => array( 'custom' => false, ), + 'layout' => array( + 'contentSize' => 'value', + 'invalid/key' => 'value', + ), 'invalid/key' => 'value', 'blocks' => array( 'core/group' => array( @@ -44,6 +48,9 @@ function test_get_settings() { 'color' => array( 'custom' => false, ), + 'layout' => array( + 'contentSize' => 'value', + ), 'blocks' => array( 'core/group' => array( 'color' => array( From 3493a0a6cb3ee436c1b89bf42bc86536c5925324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Fri, 9 Jul 2021 09:07:35 +0200 Subject: [PATCH 2/2] Fix lint issues --- phpunit/class-wp-theme-json-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index e6398f6930271c..6d44ca15362111 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -16,7 +16,7 @@ function test_get_settings() { 'color' => array( 'custom' => false, ), - 'layout' => array( + 'layout' => array( 'contentSize' => 'value', 'invalid/key' => 'value', ),