Skip to content

Commit

Permalink
Merge pull request #83 from liip/fix/wp-58
Browse files Browse the repository at this point in the history
fix(): WordPress 5.8 compatibility
  • Loading branch information
tschortsch authored Jul 13, 2021
2 parents 38fd24a + ad1322e commit 4eff01f
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 511 deletions.
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '204eb4ecaa4d12229808b10ece7277e1');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'e19f8407879a4f4734481e830ef88d43');
2 changes: 1 addition & 1 deletion build/settings.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'f667eacf17d0bdd32b04f62b195ef00e');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'e060a07f338df4d4d235b9d46d840fe0');
2 changes: 1 addition & 1 deletion languages/wp-bootstrap-blocks-de_CH.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Bootstrap Blocks plugin.
msgid ""
msgstr ""
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
"blocks\n"
"POT-Creation-Date: 2021-06-13T14:01:24+00:00\n"
Expand Down
2 changes: 1 addition & 1 deletion languages/wp-bootstrap-blocks-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Bootstrap Blocks plugin.
msgid ""
msgstr ""
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
"blocks\n"
"POT-Creation-Date: 2021-06-13T14:01:24+00:00\n"
Expand Down
2 changes: 1 addition & 1 deletion languages/wp-bootstrap-blocks.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the GPL2+.
msgid ""
msgstr ""
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-blocks\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
893 changes: 405 additions & 488 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-bootstrap-blocks",
"version": "3.3.0",
"version": "3.3.1",
"private": true,
"description": "Bootstrap Gutenberg Blocks for WordPress",
"author": "Liip AG",
Expand All @@ -18,22 +18,22 @@
"url": "https://github.com/liip/bootstrap-blocks-wordpress-plugin/issues"
},
"dependencies": {
"@wordpress/block-editor": "^6.1.3",
"@wordpress/blocks": "^9.1.3",
"@wordpress/components": "^14.1.2",
"@wordpress/compose": "^4.1.1",
"@wordpress/data": "^5.1.1",
"@wordpress/editor": "^10.1.4",
"@wordpress/block-editor": "^6.1.8",
"@wordpress/blocks": "^9.1.4",
"@wordpress/components": "^14.1.5",
"@wordpress/compose": "^4.1.2",
"@wordpress/data": "^5.1.2",
"@wordpress/editor": "^10.1.11",
"@wordpress/element": "^3.1.1",
"@wordpress/hooks": "^3.1.1",
"@wordpress/i18n": "^4.1.1"
},
"devDependencies": {
"@cypress/snapshot": "^2.1.7",
"@wordpress/base-styles": "^3.5.2",
"@wordpress/base-styles": "^3.5.4",
"@wordpress/env": "^4.0.5",
"@wordpress/scripts": "^16.1.2",
"cypress": "^7.5.0",
"@wordpress/scripts": "^16.1.4",
"cypress": "^7.6.0",
"cypress-wp-test-utils": "^0.2.0",
"cypress-xpath": "^1.6.2",
"eslint-plugin-cypress": "^2.11.3",
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: liip, tschortsch
Donate link: https://liip.ch/
Tags: gutenberg, blocks, bootstrap
Requires at least: 5.0
Tested up to: 5.7.2
Tested up to: 5.8
Requires PHP: 5.6
Stable tag: 3.3.0
Stable tag: 3.3.1
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -121,6 +121,11 @@ Please create a new GitHub issue and let us know: [https://github.com/liip/boots

== Changelog ==

= 3.3.1 =

* [COMPATIBILITY] Tested up to WordPress 5.8.
* [FIX] Use new `block_categories_all` filter instead of deprecated `block_categories` to register custom block category.

= 3.3.0 =

* [FEATURE] Added possibility to vertically align the content in a `column` block from the block controls.
Expand Down
2 changes: 1 addition & 1 deletion snapshots.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
"__version": "7.4.0",
"__version": "7.6.0",
"Row Block": {
"Row block should be available": {
"1": "<!-- wp:wp-bootstrap-blocks/row -->\n<!-- wp:wp-bootstrap-blocks/column {\"sizeMd\":6} /-->\n\n<!-- wp:wp-bootstrap-blocks/column {\"sizeMd\":6} /-->\n<!-- /wp:wp-bootstrap-blocks/row -->"
Expand Down
36 changes: 32 additions & 4 deletions src/class-wp-bootstrap-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class WP_Bootstrap_Blocks {
*
* @var string
*/
public static $version = '3.3.0';
public static $version = '3.3.1';

/**
* The plugin token.
Expand Down Expand Up @@ -127,7 +127,12 @@ protected function init_hooks() {
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ), 99 );

// Register custom block category
add_filter( 'block_categories', array( $this, 'register_custom_block_category' ), 10, 2 );
if ( class_exists( 'WP_Block_Editor_Context' ) ) {
// Class WP_Block_Editor_Context does only exist in WP >= 5.8
add_filter( 'block_categories_all', array( $this, 'register_custom_block_category' ), 10, 2 );
} else {
add_filter( 'block_categories', array( $this, 'register_custom_block_category_old' ), 10, 2 );
}

// Initialize translations
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
Expand Down Expand Up @@ -217,14 +222,37 @@ function ( $dependency ) {
/**
* Register custom block category
*
* @param array[] $block_categories Array of categories for block types.
* @param \WP_Block_Editor_Context $block_editor_context The current block editor context.
*
* @return array
*/
public function register_custom_block_category( $block_categories, $block_editor_context ) {
return $this->add_custom_block_category( $block_categories );
}

/**
* Register custom block category (Pre WP 5.8)
*
* @param array $categories List of all registered categories.
* @param \WP_Post $post Current post object.
*
* @return array
*/
public function register_custom_block_category( $categories, $post ) {
public function register_custom_block_category_old( $categories, $post ) {
return $this->add_custom_block_category( $categories );
}

/**
* Adds custom block category to given categories array
*
* @param array $block_categories List of all registered categories.
*
* @return array
*/
protected function add_custom_block_category( $block_categories ) {
return array_merge(
$categories,
$block_categories,
array(
array(
'slug' => 'wp-bootstrap-blocks',
Expand Down
2 changes: 1 addition & 1 deletion wp-bootstrap-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Bootstrap Gutenberg Blocks for WordPress.
* Author: Liip AG
* Author URI: https://liip.ch
* Version: 3.3.0
* Version: 3.3.1
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: wp-bootstrap-blocks
Expand Down

0 comments on commit 4eff01f

Please sign in to comment.