| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Depicter\Modules; |
| 4 | -; | |
| 4 | + | |
| 5 | + | |
| 5 | 6 | use Depicter\Modules\Elementor\SliderWidget; |
| 6 | 7 | use WPEmerge\ServiceProviders\ServiceProviderInterface; |
| 7 | 8 | |
| 8 | 9 | /** |
| @@ -14,8 +15,15 @@ | ||
| 14 | 15 | */ |
| 15 | 16 | public function register( $container ) { |
| 16 | 17 | add_action( 'plugins_loaded', [ $this, 'elementorModulesLoaded' ] ); |
| 17 | 18 | $this->modulesLoaded(); |
| 19 | + | |
| 20 | + $app = $container[ WPEMERGE_APPLICATION_KEY ]; | |
| 21 | + | |
| 22 | + $container[ 'depicter.modules.manager' ] = function () { | |
| 23 | + return new Modules(); | |
| 24 | + }; | |
| 25 | + $app->alias( 'modules', 'depicter.modules.manager' ); | |
| 18 | 26 | } |
| 19 | 27 | |
| 20 | 28 | public function elementorModulesLoaded() { |
| 21 | 29 | if( defined( 'ELEMENTOR_VERSION' ) ){ |
| @@ -33,9 +41,9 @@ | ||
| 33 | 41 | |
| 34 | 42 | add_action( 'vc_before_init', [ $this, 'initWPBakeryModule' ] ); |
| 35 | 43 | add_action( 'init', [ $this, 'initDiviModule' ] ); |
| 36 | 44 | |
| 37 | - // add_action( 'init', [ $this, 'loadOxygenModule' ] ); | |
| 45 | + add_action( 'init', [ $this, 'loadOxygenModule' ] ); | |
| 38 | 46 | } |
| 39 | 47 | |
| 40 | 48 | /** |
| 41 | 49 | * {@inheritDoc} |
| @@ -98,14 +106,17 @@ | ||
| 98 | 106 | } |
| 99 | 107 | |
| 100 | 108 | // load common assets |
| 101 | 109 | \Depicter::front()->assets()->enqueueStyles(); |
| 102 | - \Depicter::front()->assets()->enqueueScripts(); | |
| 110 | + \Depicter::front()->assets()->enqueueScripts(['player', 'iframe-resizer']); | |
| 103 | 111 | |
| 104 | 112 | wp_localize_script( 'wp-block-editor', 'depicterSliders',[ |
| 105 | 113 | 'list' => $list, |
| 106 | 114 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 115 | + 'editor_url' => \Depicter::editor()->getEditUrl('1'), | |
| 107 | 116 | 'token' => \Depicter::csrf()->getToken( \Depicter\Security\CSRF::EDITOR_ACTION ), |
| 117 | + 'publish_text' => esc_html__( 'Publish Slider', 'depicter' ), | |
| 118 | + 'edit_text' => esc_html__( 'Edit Slider', 'depicter' ) | |
| 108 | 119 | ]); |
| 109 | 120 | |
| 110 | 121 | } |
| 111 | 122 | |
| @@ -168,7 +179,11 @@ | ||
| 168 | 179 | |
| 169 | 180 | public function loadOxygenModule() { |
| 170 | 181 | if ( class_exists('\OxyEl') ) { |
| 171 | 182 | require_once 'Oxygen/module.php'; |
| 183 | + } | |
| 184 | + | |
| 185 | + if ( isset( $_GET['ct_builder'] ) ) { | |
| 186 | + add_action( 'wp_enqueue_scripts', [ $this, 'enqueueEditorScripts' ] ); | |
| 172 | 187 | } |
| 173 | 188 | } |
| 174 | 189 | } |