| 1 |
<?php |
| 2 |
/** |
| 3 |
* Gutenberg Blocks |
| 4 |
* |
| 5 |
* @package Copy the Code |
| 6 |
* @since 3.1.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace CopyTheCode\Gutenberg; |
| 10 |
|
| 11 |
use CopyTheCode\Gutenberg\Blocks\Icon; |
| 12 |
|
| 13 |
/** |
| 14 |
* Blocks |
| 15 |
* |
| 16 |
* @since 3.1.0 |
| 17 |
*/ |
| 18 |
class Blocks { |
| 19 |
|
| 20 |
/** |
| 21 |
* Constructor |
| 22 |
*/ |
| 23 |
public function __construct() { |
| 24 |
require_once COPY_THE_CODE_DIR . 'classes/gutenberg/blocks/icon/class-block.php'; |
| 25 |
|
| 26 |
new Icon(); |
| 27 |
|
| 28 |
add_filter( 'block_categories_all', [ $this, 'add_block_category' ], 10, 2 ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Add block category. |
| 33 |
* |
| 34 |
* @param array $categories Block categories. |
| 35 |
* @param object $post Post object. |
| 36 |
* @return array |
| 37 |
*/ |
| 38 |
public function add_block_category( $categories, $post ) { |
| 39 |
return array_merge( |
| 40 |
$categories, |
| 41 |
[ |
| 42 |
[ |
| 43 |
'slug' => 'ctc-blocks', |
| 44 |
'title' => esc_html__( 'Copy Anything to Clipboard', 'copy-the-code' ), |
| 45 |
], |
| 46 |
] |
| 47 |
); |
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
new Blocks(); |
| 53 |
|