MultiFormGoal
2 years ago
ProgressBar
2 years ago
resources
3 years ago
ServiceProvider.php
4 years ago
ServiceProvider.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\MultiFormGoals; |
| 4 | |
| 5 | use Give\Helpers\Hooks; |
| 6 | use Give\MultiFormGoals\MultiFormGoal\Block as MultiFormGoalBlock; |
| 7 | use Give\MultiFormGoals\MultiFormGoal\Shortcode as MultiFormGoalShortcode; |
| 8 | use Give\MultiFormGoals\ProgressBar\Block as ProgressBarBlock; |
| 9 | use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface; |
| 10 | |
| 11 | class ServiceProvider implements ServiceProviderInterface |
| 12 | { |
| 13 | |
| 14 | /** |
| 15 | * @inheritDoc |
| 16 | */ |
| 17 | public function register() |
| 18 | { |
| 19 | give()->singleton(MultiFormGoalShortcode::class); |
| 20 | |
| 21 | if (function_exists('register_block_type')) { |
| 22 | give()->singleton(MultiFormGoalBlock::class); |
| 23 | give()->singleton(ProgressBarBlock::class); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @inheritDoc |
| 29 | */ |
| 30 | public function boot() |
| 31 | { |
| 32 | Hooks::addAction('init', MultiFormGoalShortcode::class, 'addShortcode'); |
| 33 | |
| 34 | if (function_exists('register_block_type')) { |
| 35 | Hooks::addAction('init', MultiFormGoalBlock::class, 'addBlock'); |
| 36 | Hooks::addAction('init', ProgressBarBlock::class, 'addBlock'); |
| 37 | Hooks::addAction('enqueue_block_editor_assets', ProgressBarBlock::class, 'localizeAssets'); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 |