assets
1 month ago
css-compilers
2 years ago
css-compiler-manager.php
2 years ago
module.php
3 months ago
style-manager.php
2 months ago
style-manager.php
51 lines
| 1 | <?php |
| 2 | namespace JFB_Modules\Jet_Style; |
| 3 | |
| 4 | use Jet_Form_Builder\Classes\Instance_Trait; |
| 5 | |
| 6 | |
| 7 | class Style_Manager { |
| 8 | |
| 9 | use Instance_Trait; |
| 10 | |
| 11 | protected $manager; |
| 12 | |
| 13 | public function __construct() { |
| 14 | |
| 15 | $framework = jet_form_builder()->module( 'framework' ); |
| 16 | $loader = $framework->get_loader(); |
| 17 | $module_data = $loader->get_included_module_data( 'style-manager.php' ); |
| 18 | |
| 19 | if ( ! class_exists( '\Crocoblock\Blocks_Style\Manager' ) ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | $this->manager = new \Crocoblock\Blocks_Style\Manager( |
| 24 | array( |
| 25 | 'path' => $module_data['path'], |
| 26 | 'url' => $module_data['url'], |
| 27 | ) |
| 28 | ); |
| 29 | |
| 30 | add_action( 'jet-form-builder/block-type/before-install', array( $this, 'register_block' ) ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get style manager instance |
| 35 | * |
| 36 | * @return \Crocoblock\Blocks_Style\Manager |
| 37 | */ |
| 38 | public function get_manager() { |
| 39 | return $this->manager; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Register support for the blocks |
| 44 | * |
| 45 | * @return void |
| 46 | */ |
| 47 | public function register_block( $block_type ) { |
| 48 | $block_type->maybe_init_style_manager( $this->manager ); |
| 49 | } |
| 50 | } |
| 51 |