| 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\Term_Title; |
| 12 |
use CopyTheCode\Gutenberg\Blocks\Copy_Button; |
| 13 |
use CopyTheCode\Gutenberg\Blocks\Copy_Icon; |
| 14 |
use CopyTheCode\Gutenberg\Blocks\Social_Share; |
| 15 |
|
| 16 |
/** |
| 17 |
* Blocks |
| 18 |
* |
| 19 |
* @since 3.1.0 |
| 20 |
*/ |
| 21 |
class Blocks { |
| 22 |
|
| 23 |
/** |
| 24 |
* Constructor |
| 25 |
*/ |
| 26 |
public function __construct() { |
| 27 |
add_filter( 'block_categories_all', [ $this, 'register_category' ], 10, 2 ); |
| 28 |
|
| 29 |
require_once COPY_THE_CODE_DIR . 'classes/gutenberg/blocks/term-title/class-block.php'; |
| 30 |
require_once COPY_THE_CODE_DIR . 'classes/gutenberg/blocks/copy-button/class-block.php'; |
| 31 |
require_once COPY_THE_CODE_DIR . 'classes/gutenberg/blocks/copy-icon/class-block.php'; |
| 32 |
require_once COPY_THE_CODE_DIR . 'classes/gutenberg/blocks/social-share/class-block.php'; |
| 33 |
|
| 34 |
new Term_Title(); |
| 35 |
new Copy_Button(); |
| 36 |
new Copy_Icon(); |
| 37 |
new Social_Share(); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Register category |
| 42 |
* |
| 43 |
* @param array $categories Block categories. |
| 44 |
* @param object $post Post object. |
| 45 |
* @return array |
| 46 |
*/ |
| 47 |
public function register_category( $categories, $post ) { |
| 48 |
$categories[] = [ |
| 49 |
'slug' => 'ctc-blocks', |
| 50 |
'title' => esc_html__( 'Copy Anything to Clipboard', 'copy-the-code' ), |
| 51 |
'icon' => 'wordpress', |
| 52 |
]; |
| 53 |
return $categories; |
| 54 |
} |
| 55 |
|
| 56 |
} |
| 57 |
|
| 58 |
new Blocks(); |
| 59 |
|