ViewServiceProvider.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\View; |
| 4 | |
| 5 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 6 | |
| 7 | /** |
| 8 | * Register view composers and globals. |
| 9 | * This is an example class so feel free to modify or remove it. |
| 10 | */ |
| 11 | class ViewServiceProvider implements ServiceProviderInterface { |
| 12 | /** |
| 13 | * {@inheritDoc} |
| 14 | */ |
| 15 | public function register( $container ) { |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * {@inheritDoc} |
| 20 | */ |
| 21 | public function bootstrap( $container ) { |
| 22 | $this->registerGlobals(); |
| 23 | $this->registerComposers(); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Register view globals. |
| 28 | * |
| 29 | * @return void |
| 30 | */ |
| 31 | protected function registerGlobals() { |
| 32 | /** |
| 33 | * Globals |
| 34 | * |
| 35 | * @link https://docs.wpemerge.com/#/framework/views/overview |
| 36 | */ |
| 37 | // phpcs:ignore |
| 38 | // \SureCart::views()->addGlobal( 'foo', 'bar' ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Register view composers. |
| 43 | * |
| 44 | * @return void |
| 45 | */ |
| 46 | protected function registerComposers() { |
| 47 | /** |
| 48 | * View composers |
| 49 | * |
| 50 | * @link https://docs.wpemerge.com/#/framework/views/view-composers |
| 51 | */ |
| 52 | // phpcs:ignore |
| 53 | // \SureCart::views()->addComposer( 'partials/foo', 'FooPartialViewComposer' ); |
| 54 | } |
| 55 | } |
| 56 |