Skip to content

Commit 4eff01f

Browse files
authored
Merge pull request #83 from liip/fix/wp-58
fix(): WordPress 5.8 compatibility
2 parents 38fd24a + ad1322e commit 4eff01f

11 files changed

+461
-511
lines changed

build/index.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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');
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' => 'e19f8407879a4f4734481e830ef88d43');

build/settings.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'f667eacf17d0bdd32b04f62b195ef00e');
1+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'e060a07f338df4d4d235b9d46d840fe0');

languages/wp-bootstrap-blocks-de_CH.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the same license as the Bootstrap Blocks plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
5+
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
77
"blocks\n"
88
"POT-Creation-Date: 2021-06-13T14:01:24+00:00\n"

languages/wp-bootstrap-blocks-de_DE.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the same license as the Bootstrap Blocks plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
5+
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
77
"blocks\n"
88
"POT-Creation-Date: 2021-06-13T14:01:24+00:00\n"

languages/wp-bootstrap-blocks.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the GPL2+.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 3.3.0\n"
5+
"Project-Id-Version: Bootstrap Blocks 3.3.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-blocks\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <[email protected]>\n"

package-lock.json

Lines changed: 405 additions & 488 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-bootstrap-blocks",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"private": true,
55
"description": "Bootstrap Gutenberg Blocks for WordPress",
66
"author": "Liip AG",
@@ -18,22 +18,22 @@
1818
"url": "https://github.com/liip/bootstrap-blocks-wordpress-plugin/issues"
1919
},
2020
"dependencies": {
21-
"@wordpress/block-editor": "^6.1.3",
22-
"@wordpress/blocks": "^9.1.3",
23-
"@wordpress/components": "^14.1.2",
24-
"@wordpress/compose": "^4.1.1",
25-
"@wordpress/data": "^5.1.1",
26-
"@wordpress/editor": "^10.1.4",
21+
"@wordpress/block-editor": "^6.1.8",
22+
"@wordpress/blocks": "^9.1.4",
23+
"@wordpress/components": "^14.1.5",
24+
"@wordpress/compose": "^4.1.2",
25+
"@wordpress/data": "^5.1.2",
26+
"@wordpress/editor": "^10.1.11",
2727
"@wordpress/element": "^3.1.1",
2828
"@wordpress/hooks": "^3.1.1",
2929
"@wordpress/i18n": "^4.1.1"
3030
},
3131
"devDependencies": {
3232
"@cypress/snapshot": "^2.1.7",
33-
"@wordpress/base-styles": "^3.5.2",
33+
"@wordpress/base-styles": "^3.5.4",
3434
"@wordpress/env": "^4.0.5",
35-
"@wordpress/scripts": "^16.1.2",
36-
"cypress": "^7.5.0",
35+
"@wordpress/scripts": "^16.1.4",
36+
"cypress": "^7.6.0",
3737
"cypress-wp-test-utils": "^0.2.0",
3838
"cypress-xpath": "^1.6.2",
3939
"eslint-plugin-cypress": "^2.11.3",

readme.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Contributors: liip, tschortsch
33
Donate link: https://liip.ch/
44
Tags: gutenberg, blocks, bootstrap
55
Requires at least: 5.0
6-
Tested up to: 5.7.2
6+
Tested up to: 5.8
77
Requires PHP: 5.6
8-
Stable tag: 3.3.0
8+
Stable tag: 3.3.1
99
License: GPLv2
1010
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1111

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

122122
== Changelog ==
123123

124+
= 3.3.1 =
125+
126+
* [COMPATIBILITY] Tested up to WordPress 5.8.
127+
* [FIX] Use new `block_categories_all` filter instead of deprecated `block_categories` to register custom block category.
128+
124129
= 3.3.0 =
125130

126131
* [FEATURE] Added possibility to vertically align the content in a `column` block from the block controls.

snapshots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
"__version": "7.4.0",
2+
"__version": "7.6.0",
33
"Row Block": {
44
"Row block should be available": {
55
"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 -->"

src/class-wp-bootstrap-blocks.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class WP_Bootstrap_Blocks {
3333
*
3434
* @var string
3535
*/
36-
public static $version = '3.3.0';
36+
public static $version = '3.3.1';
3737

3838
/**
3939
* The plugin token.
@@ -127,7 +127,12 @@ protected function init_hooks() {
127127
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ), 99 );
128128

129129
// Register custom block category
130-
add_filter( 'block_categories', array( $this, 'register_custom_block_category' ), 10, 2 );
130+
if ( class_exists( 'WP_Block_Editor_Context' ) ) {
131+
// Class WP_Block_Editor_Context does only exist in WP >= 5.8
132+
add_filter( 'block_categories_all', array( $this, 'register_custom_block_category' ), 10, 2 );
133+
} else {
134+
add_filter( 'block_categories', array( $this, 'register_custom_block_category_old' ), 10, 2 );
135+
}
131136

132137
// Initialize translations
133138
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
@@ -217,14 +222,37 @@ function ( $dependency ) {
217222
/**
218223
* Register custom block category
219224
*
225+
* @param array[] $block_categories Array of categories for block types.
226+
* @param \WP_Block_Editor_Context $block_editor_context The current block editor context.
227+
*
228+
* @return array
229+
*/
230+
public function register_custom_block_category( $block_categories, $block_editor_context ) {
231+
return $this->add_custom_block_category( $block_categories );
232+
}
233+
234+
/**
235+
* Register custom block category (Pre WP 5.8)
236+
*
220237
* @param array $categories List of all registered categories.
221238
* @param \WP_Post $post Current post object.
222239
*
223240
* @return array
224241
*/
225-
public function register_custom_block_category( $categories, $post ) {
242+
public function register_custom_block_category_old( $categories, $post ) {
243+
return $this->add_custom_block_category( $categories );
244+
}
245+
246+
/**
247+
* Adds custom block category to given categories array
248+
*
249+
* @param array $block_categories List of all registered categories.
250+
*
251+
* @return array
252+
*/
253+
protected function add_custom_block_category( $block_categories ) {
226254
return array_merge(
227-
$categories,
255+
$block_categories,
228256
array(
229257
array(
230258
'slug' => 'wp-bootstrap-blocks',

0 commit comments

Comments
 (0)