Blocks
2 weeks ago
Assets.php
2 weeks ago
Configuration.php
2 weeks ago
Configuration_Interface.php
2 weeks ago
Meta.php
2 weeks ago
Meta_Interface.php
2 weeks ago
Provider.php
2 weeks ago
Utils.php
2 weeks ago
Provider.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | class Tribe__Editor__Provider extends tad_DI52_ServiceProvider { |
| 4 | |
| 5 | /** |
| 6 | * Binds and sets up implementations. |
| 7 | * |
| 8 | * @since 4.8 |
| 9 | * |
| 10 | */ |
| 11 | public function register() { |
| 12 | // Setup to check if gutenberg is active |
| 13 | $this->container->singleton( 'editor', 'Tribe__Editor' ); |
| 14 | $this->container->singleton( 'editor.utils', 'Tribe__Editor__Utils' ); |
| 15 | $this->container->singleton( 'common.editor.configuration', 'Tribe__Editor__Configuration' ); |
| 16 | |
| 17 | if ( ! tribe( 'editor' )->should_load_blocks() ) { |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | $this->container->singleton( 'editor.assets', 'Tribe__Editor__Assets', [ 'hook' ] ); |
| 22 | |
| 23 | $this->hook(); |
| 24 | |
| 25 | // Initialize the correct Singletons |
| 26 | tribe( 'editor.assets' ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Any hooking any class needs happen here. |
| 31 | * |
| 32 | * In place of delegating the hooking responsibility to the single classes they are all hooked here. |
| 33 | * |
| 34 | * @since 4.8 |
| 35 | * |
| 36 | */ |
| 37 | protected function hook() { |
| 38 | // Setup the registration of Blocks |
| 39 | add_action( 'init', [ $this, 'register_blocks' ], 20 ); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Prevents us from using `init` to register our own blocks, allows us to move |
| 44 | * it when the proper place shows up |
| 45 | * |
| 46 | * @since 4.8.2 |
| 47 | * |
| 48 | * @return void |
| 49 | */ |
| 50 | public function register_blocks() { |
| 51 | /** |
| 52 | * Internal Action used to register blocks for Events |
| 53 | * |
| 54 | * @since 4.8.2 |
| 55 | */ |
| 56 | do_action( 'tribe_editor_register_blocks' ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Binds and sets up implementations at boot time. |
| 61 | * |
| 62 | * @since 4.8 |
| 63 | */ |
| 64 | public function boot() { |
| 65 | // no ops |
| 66 | } |
| 67 | } |
| 68 |