From 46888eddbf615aaf75655595f1167e8167c9afdf Mon Sep 17 00:00:00 2001 From: Will Skora Date: Tue, 19 Oct 2021 14:05:05 -0400 Subject: [PATCH 1/3] add conditional for detecting wide-align support declared through theme.json --- class-block-unit-test.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/class-block-unit-test.php b/class-block-unit-test.php index 9269bfc..d97fdb1 100644 --- a/class-block-unit-test.php +++ b/class-block-unit-test.php @@ -210,6 +210,9 @@ public function upgrade_completed( $upgrader_object, $options ) { */ public function content() { + $layout_settings = gutenberg_get_global_settings(array( 'layout' )); + $content_size_in_theme_json = $layout_settings['contentSize']; + $content = ''; $content .= ' @@ -598,7 +601,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) ) { $content .= '
@@ -666,7 +669,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) || isset( $content_size_in_theme_json ) ) { $content .= '

' . esc_html__( 'Wide aligned', '@@textdomain' ) . '

@@ -724,7 +727,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) ) { $content .= '

' . esc_html__( 'Wide aligned', '@@textdomain' ) . '

@@ -760,7 +763,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) ) { $content .= '

' . esc_html__( 'Wide aligned', '@@textdomain' ) . '

@@ -1037,7 +1040,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) ) { $content .= '

Wide aligned Gallery Blocks

From 8e2191aea0e2abff804c4f765a3dc447cfef4622 Mon Sep 17 00:00:00 2001 From: Will Skora Date: Wed, 20 Oct 2021 15:05:17 -0400 Subject: [PATCH 2/3] remove dupicate conditional --- class-block-unit-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-block-unit-test.php b/class-block-unit-test.php index d97fdb1..157ce10 100644 --- a/class-block-unit-test.php +++ b/class-block-unit-test.php @@ -669,7 +669,7 @@ public function content() { '; - if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) || isset( $content_size_in_theme_json ) ) { + if ( get_theme_support( 'align-wide' ) || isset( $content_size_in_theme_json ) ) { $content .= '

' . esc_html__( 'Wide aligned', '@@textdomain' ) . '

From efc29a8984f6533e501f7e0c9d2f29042d0b5335 Mon Sep 17 00:00:00 2001 From: Will Skora Date: Mon, 13 Dec 2021 11:43:04 -0500 Subject: [PATCH 3/3] rename get_global_settings function to reflect gutenberg 12.1 --- class-block-unit-test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-block-unit-test.php b/class-block-unit-test.php index 157ce10..5d01bac 100644 --- a/class-block-unit-test.php +++ b/class-block-unit-test.php @@ -210,7 +210,7 @@ public function upgrade_completed( $upgrader_object, $options ) { */ public function content() { - $layout_settings = gutenberg_get_global_settings(array( 'layout' )); + $layout_settings = wp_get_global_settings(array( 'layout' )); $content_size_in_theme_json = $layout_settings['contentSize']; $content = '';