Conditions
1 year ago
Documents
1 year ago
DynamicTags
4 months ago
Widgets
2 months ago
assets
4 months ago
ElementorBlockAdapterService.php
4 months ago
ElementorCoreBlockStylesService.php
1 year ago
ElementorDocumentsService.php
1 year ago
ElementorDynamicTagsService.php
1 year ago
ElementorEditorService.php
1 year ago
ElementorFseScriptLoaderService.php
1 year ago
ElementorServiceProvider.php
8 months ago
ElementorShortcodeService.php
1 year ago
ElementorTemplatesService.php
4 months ago
ElementorWidgetsService.php
8 months ago
ElementorServiceProvider.php
77 lines
| 1 | <?php |
| 2 | namespace SureCart\Integrations\Elementor; |
| 3 | |
| 4 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 5 | |
| 6 | /** |
| 7 | * Elementor service provider. |
| 8 | */ |
| 9 | class ElementorServiceProvider implements ServiceProviderInterface { |
| 10 | /** |
| 11 | * Register all dependencies in the IoC container. |
| 12 | * |
| 13 | * @param \Pimple\Container $container Service container. |
| 14 | * @return void |
| 15 | */ |
| 16 | public function register( $container ) { |
| 17 | // Check if Elementor is installed. |
| 18 | if ( ! class_exists( '\Elementor\Plugin' ) ) { |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | // Templates service. This is used even if Elementor is not installed. |
| 23 | $container['elementor.templates.service'] = fn() => new ElementorTemplatesService(); |
| 24 | |
| 25 | // Widgets. |
| 26 | $container['surecart.elementor.widgets'] = fn() => new ElementorWidgetsService(); |
| 27 | |
| 28 | // Widgets. |
| 29 | $container['surecart.elementor.editor'] = fn() => new ElementorEditorService(); |
| 30 | |
| 31 | // Documents. |
| 32 | $container['surecart.elementor.documents'] = fn() => new ElementorDocumentsService(); |
| 33 | |
| 34 | // Dynamic tags. |
| 35 | $container['surecart.elementor.dynamic_tags'] = fn() => new ElementorDynamicTagsService(); |
| 36 | |
| 37 | // Core block styles. |
| 38 | $container['elementor.core.block.styles.service'] = fn() => new ElementorCoreBlockStylesService(); |
| 39 | |
| 40 | // Shortcode service. |
| 41 | $container['elementor.shortcode.service'] = fn() => new ElementorShortcodeService(); |
| 42 | |
| 43 | // Block adapter service. |
| 44 | $container['elementor.block.adapter.service'] = fn() => new ElementorBlockAdapterService(); |
| 45 | |
| 46 | // FSE script loader service for Elementor. |
| 47 | $container['elementor.fse.script.loader'] = fn() => new ElementorFseScriptLoaderService(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * {@inheritDoc} |
| 52 | * |
| 53 | * @param \Pimple\Container $container Service Container. |
| 54 | */ |
| 55 | public function bootstrap( $container ) { |
| 56 | if ( ! class_exists( '\Elementor\Plugin' ) ) { |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | // bootstrap the core block styles service. |
| 61 | $container['elementor.core.block.styles.service']->bootstrap(); |
| 62 | $container['elementor.shortcode.service']->bootstrap(); |
| 63 | $container['surecart.elementor.widgets']->bootstrap(); |
| 64 | $container['surecart.elementor.editor']->bootstrap(); |
| 65 | $container['surecart.elementor.dynamic_tags']->bootstrap(); |
| 66 | $container['elementor.fse.script.loader']->bootstrap(); |
| 67 | |
| 68 | // The rest are only needed if Elementor Pro is installed. |
| 69 | if ( ! defined( 'ELEMENTOR_PRO_VERSION' ) ) { |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | $container['elementor.block.adapter.service']->bootstrap(); |
| 74 | $container['surecart.elementor.documents']->bootstrap(); |
| 75 | } |
| 76 | } |
| 77 |