button-types
2 months ago
conditional-block
2 years ago
exceptions
2 years ago
modules
2 months ago
render
2 weeks ago
types
1 week ago
action-buttons-manager.php
2 years ago
block-helper.php
2 weeks ago
blocks-repository-base.php
2 months ago
default-blocks-repository.php
2 years ago
dynamic-value.php
1 year ago
form-builder-blocks-repository.php
1 year ago
module.php
1 year ago
native-block-wrapper-attributes.php
2 years ago
blocks-repository-base.php
44 lines
| 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 |