AmplitudeProvider.php
2 months ago
AssetsProvider.php
11 months ago
BlocksProvider.php
3 months ago
ClientProvider.php
2 months ago
ContainerProvider.php
11 months ago
DatabaseProvider.php
8 months ago
HostingRoutesProvider.php
2 months ago
IntegrationsProvider.php
5 months ago
JobsProvider.php
7 months ago
MenusProvider.php
11 months ago
NoticesProvider.php
4 months ago
ProviderInterface.php
11 months ago
RedirectsProvider.php
11 months ago
RoutesProvider.php
9 months ago
SurveysProvider.php
2 months ago
TrackingProvider.php
8 months ago
WebhooksProvider.php
8 months ago
WpdbProvider.php
11 months ago
BlocksProvider.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger\Reach\Providers; |
| 4 | |
| 5 | use Hostinger\Reach\Blocks\SubscriptionFormBlock; |
| 6 | use Hostinger\Reach\Container; |
| 7 | use Hostinger\Reach\Setup\Blocks; |
| 8 | use Hostinger\Reach\Setup\Assets; |
| 9 | use Hostinger\Reach\Functions; |
| 10 | use Hostinger\Reach\Api\Handlers\ReachApiHandler; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | die; |
| 14 | } |
| 15 | |
| 16 | class BlocksProvider implements ProviderInterface { |
| 17 | public function register( Container $container ): void { |
| 18 | $container->set( |
| 19 | SubscriptionFormBlock::class, |
| 20 | function () use ( $container ) { |
| 21 | return new SubscriptionFormBlock( |
| 22 | $container->get( Assets::class ), |
| 23 | $container->get( Functions::class ), |
| 24 | $container->get( ReachApiHandler::class ) |
| 25 | ); |
| 26 | } |
| 27 | ); |
| 28 | |
| 29 | $container->set( |
| 30 | Blocks::class, |
| 31 | function () use ( $container ) { |
| 32 | return new Blocks( $container->get( SubscriptionFormBlock::class ) ); |
| 33 | } |
| 34 | ); |
| 35 | |
| 36 | $blocks = $container->get( Blocks::class ); |
| 37 | $blocks->init(); |
| 38 | } |
| 39 | } |
| 40 |