| 1 |
<?php |
| 2 |
namespace TSB; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
class BlockCategory { |
| 9 |
|
| 10 |
public function __construct() { |
| 11 |
add_filter( 'block_categories_all', [ $this, 'register_category' ], 10, 2 ); |
| 12 |
} |
| 13 |
|
| 14 |
public function register_category( $categories, $context ) { |
| 15 |
if ( ! is_array( $categories ) ) { |
| 16 |
$categories = []; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
array_unshift( $categories, [ |
| 21 |
'slug' => 'team-section', |
| 22 |
'title' => __( 'Team Blocks', 'team-section' ), |
| 23 |
'icon' => null, |
| 24 |
] ); |
| 25 |
|
| 26 |
return $categories; |
| 27 |
} |
| 28 |
} |
| 29 |
|