| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace Jet_Form_Builder\Blocks; |
| 5 |
|
| 6 |
use JFB_Components\Repository\Repository_Pattern_Trait; |
| 7 |
use Jet_Form_Builder\Exceptions\Repository_Exception; |
| 8 |
|
| 9 |
// If this file is called directly, abort. |
| 10 |
if ( ! defined( 'WPINC' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
abstract class Blocks_Repository_Base { |
| 15 |
|
| 16 |
use Repository_Pattern_Trait; |
| 17 |
|
| 18 |
/** |
| 19 |
* @param $block_type |
| 20 |
* |
| 21 |
* @throws Repository_Exception |
| 22 |
*/ |
| 23 |
public function rep_before_install_item( $block_type ) { |
| 24 |
/** @var Types\Base $block_type */ |
| 25 |
|
| 26 |
do_action( 'jet-form-builder/block-type/before-install', $block_type ); |
| 27 |
|
| 28 |
// throw exception & exclude from repository if block is not supported |
| 29 |
if ( ! $block_type->is_supported() ) { |
| 30 |
$this->_rep_abort_this(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* @param $block_type |
| 36 |
*/ |
| 37 |
public function rep_after_install_item( $block_type ) { |
| 38 |
/** @var Types\Base $block_type */ |
| 39 |
|
| 40 |
$block_type->register_block_type(); |
| 41 |
} |
| 42 |
|
| 43 |
} |
| 44 |
|