PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / trunk
GutSlider – All in One Slider and Carousel Blocks for Gutenberg vtrunk
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
slider-blocks / includes / Blocks / BlocksCategory.php

BlocksCategory.php in GutSlider – All in One Slider and Carousel Blocks for Gutenberg trunk, at includes/Blocks/BlocksCategory.php

63 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 declare( strict_types=1 );
3
4 namespace GutSlider\Blocks;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 /**
11 * Registers the custom block category for GutSlider blocks.
12 *
13 * Adds a "GutSlider Blocks" category to the block editor so that
14 * all slider blocks are grouped together in the inserter.
15 *
16 * @package GutSlider\Blocks
17 * @since 3.0.0
18 */
19 final class BlocksCategory {
20
21 /**
22 * Constructor.
23 *
24 * Registers the block_categories_all filter hook.
25 *
26 * @since 3.0.0
27 */
28 public function __construct() {
29 add_filter( 'block_categories_all', array( $this, 'register_block_category' ), 10, 2 );
30 }
31
32 /**
33 * Register the GutSlider block category.
34 *
35 * Prepends the slider-blocks category to the list of available
36 * block categories in the editor.
37 *
38 * @since 3.0.0
39 *
40 * @param array<int, array<string, mixed>> $categories Existing block categories.
41 * @param \WP_Block_Editor_Context $context The block editor context.
42 * @return array<int, array<string, mixed>> Modified block categories.
43 */
44 // public function register_block_category( array $categories, \WP_Block_Editor_Context $context ): array {
45 // $new_category = array(
46 // 'slug' => 'slider-blocks',
47 // 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
48 // );
49
50 // return array_merge( array( $new_category ), $categories );
51 // }
52
53 public function register_block_category( $categories, $post ) {
54
55 array_unshift( $categories, array(
56 'slug' => 'slider-blocks',
57 'title' => __( 'GutSlider Blocks', 'slider-blocks' ),
58 ) );
59
60 return $categories;
61 }
62 }
63