From 1c8d83e0cd1b5cd146f7e9afea56ddf5790ff364 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Fri, 23 Nov 2018 17:52:36 +0100 Subject: [PATCH 1/4] Gutenberg: Move blocks directory definition to a method --- class.jetpack-gutenberg.php | 38 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/class.jetpack-gutenberg.php b/class.jetpack-gutenberg.php index 65aec1325798..5733519b3100 100644 --- a/class.jetpack-gutenberg.php +++ b/class.jetpack-gutenberg.php @@ -1,7 +1,7 @@ Date: Fri, 23 Nov 2018 17:54:36 +0100 Subject: [PATCH 2/4] Gutenberg: Use Blocks from staging dir if proxied --- class.jetpack-gutenberg.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/class.jetpack-gutenberg.php b/class.jetpack-gutenberg.php index 5733519b3100..58c7cbc48f6d 100644 --- a/class.jetpack-gutenberg.php +++ b/class.jetpack-gutenberg.php @@ -89,6 +89,9 @@ public static function load_blocks() { * @return string The Gutenberg extensions directory */ public static function get_blocks_directory() { + if ( function_exists( 'wpcom_is_proxied_request' ) && wpcom_is_proxied_request() ) { + return '_inc/blocks-staging/'; + } return '_inc/blocks/'; } From 84c1cfbe833ddd9722ae5a7f06c78b562b5fc2a6 Mon Sep 17 00:00:00 2001 From: Miguel Lezama Date: Fri, 23 Nov 2018 16:46:18 -0300 Subject: [PATCH 3/4] jetpack_blocks_load_staging filter --- class.jetpack-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class.jetpack-gutenberg.php b/class.jetpack-gutenberg.php index 58c7cbc48f6d..b560ba1bddbd 100644 --- a/class.jetpack-gutenberg.php +++ b/class.jetpack-gutenberg.php @@ -89,7 +89,7 @@ public static function load_blocks() { * @return string The Gutenberg extensions directory */ public static function get_blocks_directory() { - if ( function_exists( 'wpcom_is_proxied_request' ) && wpcom_is_proxied_request() ) { + if ( apply_filters( 'jetpack_blocks_load_staging', false ) ) { return '_inc/blocks-staging/'; } return '_inc/blocks/'; From 05e09f3dffa6b73deb543493244df019060b9e9e Mon Sep 17 00:00:00 2001 From: Miguel Lezama Date: Fri, 23 Nov 2018 16:54:48 -0300 Subject: [PATCH 4/4] let's do it jetpack_blocks_directory props @enejb --- class.jetpack-gutenberg.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/class.jetpack-gutenberg.php b/class.jetpack-gutenberg.php index b560ba1bddbd..d94c605d4f76 100644 --- a/class.jetpack-gutenberg.php +++ b/class.jetpack-gutenberg.php @@ -89,10 +89,14 @@ public static function load_blocks() { * @return string The Gutenberg extensions directory */ public static function get_blocks_directory() { - if ( apply_filters( 'jetpack_blocks_load_staging', false ) ) { - return '_inc/blocks-staging/'; - } - return '_inc/blocks/'; + /** + * Filter to select Gutenberg blocks directory + * + * @since 6.9 + * + * @param string default: '_inc/blocks/' + */ + return apply_filters( 'jetpack_blocks_directory', '_inc/blocks/' ); } /**