From a65a57bd8ef0d1eac4ec8668a4e51ccf05775b3e Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sat, 30 Apr 2022 15:30:29 +0700 Subject: [PATCH 1/3] revert #5653 --- src/BlockTypesController.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/BlockTypesController.php b/src/BlockTypesController.php index dd0357c61e1..a37462acf0f 100644 --- a/src/BlockTypesController.php +++ b/src/BlockTypesController.php @@ -193,20 +193,10 @@ protected function get_block_types() { 'ProductSummary', 'ProductTagList', 'ProductTitle', + 'MiniCart', + 'MiniCartContent', ]; - /** - * Mini Cart blocks should be available in Site Editor, Widgets and frontend (is_admin function checks this) only. - */ - if ( - ! is_admin() || - in_array( $pagenow, [ 'widgets.php', 'customize.php', 'site-editor.php' ], true ) || - ! empty( $_GET['page'] ) && 'gutenberg-edit-site' === $_GET['page'] // phpcs:ignore WordPress.Security.NonceVerification - ) { - $block_types[] = 'MiniCart'; - $block_types[] = 'MiniCartContents'; - } - if ( Package::feature()->is_feature_plugin_build() ) { $block_types[] = 'Checkout'; $block_types[] = 'Cart'; From 407243c37b640147baf4b7629e7898a6cf4eef60 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sat, 30 Apr 2022 15:30:44 +0700 Subject: [PATCH 2/3] remove unused global variable --- src/BlockTypesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BlockTypesController.php b/src/BlockTypesController.php index a37462acf0f..41f89baeefb 100644 --- a/src/BlockTypesController.php +++ b/src/BlockTypesController.php @@ -157,7 +157,7 @@ public function hide_legacy_widgets_with_block_equivalent( $widget_types ) { * @return array */ protected function get_block_types() { - global $wp_version, $pagenow; + global $pagenow; $block_types = [ 'AllReviews', From 51e756e80ad58db78342a9e032ad8116c480eb37 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sat, 30 Apr 2022 15:33:01 +0700 Subject: [PATCH 3/3] fix class name --- src/BlockTypesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BlockTypesController.php b/src/BlockTypesController.php index 41f89baeefb..554bc8acacd 100644 --- a/src/BlockTypesController.php +++ b/src/BlockTypesController.php @@ -194,7 +194,7 @@ protected function get_block_types() { 'ProductTagList', 'ProductTitle', 'MiniCart', - 'MiniCartContent', + 'MiniCartContents', ]; if ( Package::feature()->is_feature_plugin_build() ) {