class-tb-admin.php
2 weeks ago
class-tb-block-helper.php
2 weeks ago
class-tb-config.php
2 weeks ago
class-tb-core-plugin.php
2 weeks ago
class-tb-helper.php
2 weeks ago
class-tb-init-blocks.php
2 weeks ago
class-tb-loader.php
2 weeks ago
class-tb-init-blocks.php
84 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * TB Blocks Initializer |
| 5 | * |
| 6 | * Enqueue CSS/JS of all the blocks. |
| 7 | * |
| 8 | * @since 1.0.0 |
| 9 | * @package TB |
| 10 | */ |
| 11 | if (!defined('ABSPATH')) { |
| 12 | exit; // Exit if accessed directly. |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * TB_Init_Blocks. |
| 17 | * |
| 18 | * @package TB |
| 19 | */ |
| 20 | class TB_Init_Blocks { |
| 21 | |
| 22 | /** |
| 23 | * Member Variable |
| 24 | * |
| 25 | * @var instance |
| 26 | */ |
| 27 | private static $instance; |
| 28 | |
| 29 | /** |
| 30 | * Initiator |
| 31 | */ |
| 32 | public static function get_instance() { |
| 33 | if (!isset(self::$instance)) { |
| 34 | self::$instance = new self; |
| 35 | } |
| 36 | return self::$instance; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Constructor |
| 41 | */ |
| 42 | public function __construct() { |
| 43 | |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Enqueue Gutenberg block assets for both frontend + backend. |
| 48 | * |
| 49 | * @since 1.0.0 |
| 50 | */ |
| 51 | function block_assets() { |
| 52 | |
| 53 | } |
| 54 | |
| 55 | // End function editor_assets(). |
| 56 | |
| 57 | /** |
| 58 | * Enqueue Gutenberg block assets for backend editor. |
| 59 | * |
| 60 | * @since 1.0.0 |
| 61 | */ |
| 62 | function editor_assets() { |
| 63 | |
| 64 | wp_localize_script( |
| 65 | 'tb-block-editor-js', 'tb_blocks_info', array( |
| 66 | 'blocks' => TB_Config::get_block_attributes(), |
| 67 | 'category' => 'timeline-blocks', |
| 68 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 69 | 'image_sizes' => TB_Helper::get_image_sizes(), |
| 70 | 'post_types' => TB_Helper::get_post_types(), |
| 71 | 'all_taxonomy' => TB_Helper::get_related_taxonomy(), |
| 72 | ) |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | // End function editor_assets(). |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Prepare if class 'TB_Init_Blocks' exist. |
| 81 | * Kicking this off by calling 'get_instance()' method |
| 82 | */ |
| 83 | TB_Init_Blocks::get_instance(); |
| 84 |