PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 2.9.7
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v2.9.7
3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 2.6.1 All 56 releases
← All changes | includes/classes/class-blocks-category.php +13 -20 2.3.02.9.7 View file →
@@ -3,43 +3,36 @@
3 3 * Register Blocks Category
4 4 * @package GutSliderBlocks
5 5 */
6 6
7 - if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
7 +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
8 8
9 - if( ! class_exists( 'GutSlider_Blocks_Category' ) ) {
9 +if ( ! class_exists( 'GutSlider_Blocks_Category' ) ) {
10 10
11 11 class GutSlider_Blocks_Category {
12 12
13 13 /**
14 14 * Constructor
15 - * return void
16 15 */
17 16 public function __construct() {
18 - if( version_compare( $GLOBALS['wp_version'], '5.7', '<' ) ) {
19 - add_filter( 'block_categories', [ $this, 'register_block_category' ], 10, 2, 9999 );
20 - } else {
21 - add_filter( 'block_categories_all', [ $this, 'register_block_category' ], 10, 2, 9999 );
22 - }
17 + $filter = version_compare( $GLOBALS['wp_version'], '5.7', '<' ) ? 'block_categories' : 'block_categories_all';
18 + add_filter( $filter, [ $this, 'register_block_category' ], 10, 2 );
23 19 }
24 20
25 21 /**
26 22 * Register Block Category
27 - * return array
23 + * @param array $categories
24 + * @param WP_Post $post
25 + * @return array
28 26 */
29 27 public function register_block_category( $categories, $post ) {
30 - return array_merge(
31 - array(
32 - array(
33 - 'slug' => 'slider-blocks',
34 - 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
35 - ),
36 - ),
37 - $categories,
28 + $new_category = array(
29 + 'slug' => 'slider-blocks',
30 + 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
38 31 );
32 + return array_merge( array( $new_category ), $categories );
39 33 }
40 34
41 35 }
42 36
43 - }
44 -
45 - new GutSlider_Blocks_Category(); // Initialize the class
37 + new GutSlider_Blocks_Category(); // Initialize the class
38 +}