WooCommerce Gutenberg Products Block - Version 2.0.1

Version Description

  • 2019-04-22 =

  • Fix: Fix warnings about blocks already being registered.

  • Fix: Fix a conflict with WooCommerce 3.6 and WooCommerce Blocks 1.4 (this change only applies to the version of blocks bundled with WooCommerce core).

Download this release

Release Info

Developer ryelle
Plugin Icon 128x128 WooCommerce Gutenberg Products Block
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

assets/php/class-wgpb-block-library.php CHANGED
@@ -37,17 +37,24 @@ class WGPB_Block_Library {
37
  * Constructor.
38
  */
39
  public function __construct() {
 
 
 
 
 
 
 
 
 
40
  // Shortcut out if we see the feature plugin, v1.4 or below.
41
  // note: `FP_VERSION` is transformed to `WGPB_VERSION` in the grunt copy task.
42
  if ( defined( 'FP_VERSION' ) && version_compare( FP_VERSION, '1.4.0', '<=' ) ) {
43
  return;
44
  }
45
- if ( function_exists( 'register_block_type' ) ) {
46
- add_action( 'init', array( 'WGPB_Block_Library', 'register_blocks' ) );
47
- add_action( 'init', array( 'WGPB_Block_Library', 'register_assets' ) );
48
- add_filter( 'block_categories', array( 'WGPB_Block_Library', 'add_block_category' ) );
49
- add_action( 'admin_print_footer_scripts', array( 'WGPB_Block_Library', 'print_script_settings' ), 1 );
50
- }
51
  }
52
 
53
  /**
37
  * Constructor.
38
  */
39
  public function __construct() {
40
+ if ( function_exists( 'register_block_type' ) ) {
41
+ add_action( 'init', array( 'WGPB_Block_Library', 'init' ) );
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Initialize block library features.
47
+ */
48
+ public static function init() {
49
  // Shortcut out if we see the feature plugin, v1.4 or below.
50
  // note: `FP_VERSION` is transformed to `WGPB_VERSION` in the grunt copy task.
51
  if ( defined( 'FP_VERSION' ) && version_compare( FP_VERSION, '1.4.0', '<=' ) ) {
52
  return;
53
  }
54
+ self::register_blocks();
55
+ self::register_assets();
56
+ add_filter( 'block_categories', array( 'WGPB_Block_Library', 'add_block_category' ) );
57
+ add_action( 'admin_print_footer_scripts', array( 'WGPB_Block_Library', 'print_script_settings' ), 1 );
 
 
58
  }
59
 
60
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products
4
  Requires at least: 5.0
5
  Tested up to: 5.2
6
  Requires PHP: 5.2
7
- Stable tag: 2.0.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -83,6 +83,11 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
86
  = 2.0.0 - 2019-04-18 =
87
 
88
  - **BREAKING:** Requires WordPress 5.0+, WooCommerce 3.6+
4
  Requires at least: 5.0
5
  Tested up to: 5.2
6
  Requires PHP: 5.2
7
+ Stable tag: 2.0.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
83
 
84
  == Changelog ==
85
 
86
+ = 2.0.1 - 2019-04-22 =
87
+
88
+ - Fix: Fix warnings about blocks already being registered.
89
+ - Fix: Fix a conflict with WooCommerce 3.6 and WooCommerce Blocks 1.4 (this change only applies to the version of blocks bundled with WooCommerce core).
90
+
91
  = 2.0.0 - 2019-04-18 =
92
 
93
  - **BREAKING:** Requires WordPress 5.0+, WooCommerce 3.6+
woocommerce-gutenberg-products-block.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Blocks
4
  * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
5
  * Description: WooCommerce blocks for the Gutenberg editor.
6
- * Version: 2.0.0
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Text Domain: woo-gutenberg-products-block
@@ -15,7 +15,7 @@
15
 
16
  defined( 'ABSPATH' ) || die();
17
 
18
- define( 'WGPB_VERSION', '2.0.0' );
19
  define( 'WGPB_PLUGIN_FILE', __FILE__ );
20
  define( 'WGPB_ABSPATH', dirname( WGPB_PLUGIN_FILE ) . '/' );
21
 
@@ -25,7 +25,9 @@ define( 'WGPB_ABSPATH', dirname( WGPB_PLUGIN_FILE ) . '/' );
25
  function wgpb_initialize() {
26
  require_once plugin_dir_path( __FILE__ ) . 'assets/php/class-wgpb-block-library.php';
27
 
28
- // Remove core hooks in favor of our local feature plugin handlers.
 
 
29
  remove_action( 'init', array( 'WC_Block_Library', 'register_blocks' ) );
30
  remove_action( 'init', array( 'WC_Block_Library', 'register_assets' ) );
31
  remove_filter( 'block_categories', array( 'WC_Block_Library', 'add_block_category' ) );
3
  * Plugin Name: WooCommerce Blocks
4
  * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
5
  * Description: WooCommerce blocks for the Gutenberg editor.
6
+ * Version: 2.0.1
7
  * Author: Automattic
8
  * Author URI: https://woocommerce.com
9
  * Text Domain: woo-gutenberg-products-block
15
 
16
  defined( 'ABSPATH' ) || die();
17
 
18
+ define( 'WGPB_VERSION', '2.0.1' );
19
  define( 'WGPB_PLUGIN_FILE', __FILE__ );
20
  define( 'WGPB_ABSPATH', dirname( WGPB_PLUGIN_FILE ) . '/' );
21
 
25
  function wgpb_initialize() {
26
  require_once plugin_dir_path( __FILE__ ) . 'assets/php/class-wgpb-block-library.php';
27
 
28
+ // Remove core hook in favor of our local feature plugin handler.
29
+ remove_action( 'init', array( 'WC_Block_Library', 'init' ) );
30
+ // Remove core hooks from pre-3.6 (in 3.6.2 all functions were moved to one hook on init).
31
  remove_action( 'init', array( 'WC_Block_Library', 'register_blocks' ) );
32
  remove_action( 'init', array( 'WC_Block_Library', 'register_assets' ) );
33
  remove_filter( 'block_categories', array( 'WC_Block_Library', 'add_block_category' ) );