← All changes
|
modules/atomic-widgets/opt-in/opt-in.php
+14
-24
4.3.0-beta2
→
3.35.0-dev4
View file →
| @@ -3,31 +3,40 @@ | ||
| 3 | 3 | namespace Elementor\Modules\AtomicWidgets\OptIn; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 6 | 6 | use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 7 | +use Elementor\Modules\GlobalClasses\Module as GlobalClassesModule; | |
| 8 | +use Elementor\Modules\NestedElements\Module as NestedElementsModule; | |
| 7 | 9 | use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule; |
| 10 | +use Elementor\Modules\Variables\Module as VariablesModule; | |
| 11 | +use Elementor\Modules\Components\Module as ComponentsModule; | |
| 8 | 12 | use Elementor\Plugin; |
| 9 | 13 | |
| 10 | 14 | class Opt_In { |
| 11 | 15 | const EXPERIMENT_NAME = 'e_opt_in_v4'; |
| 12 | 16 | |
| 13 | - const OPT_IN_FEATURES = [ | |
| 17 | + const OPT_OUT_FEATURES = [ | |
| 14 | 18 | self::EXPERIMENT_NAME, |
| 15 | - 'container', | |
| 16 | 19 | AtomicWidgetsModule::EXPERIMENT_NAME, |
| 20 | + GlobalClassesModule::NAME, | |
| 21 | + VariablesModule::EXPERIMENT_NAME, | |
| 22 | + ComponentsModule::EXPERIMENT_NAME, | |
| 17 | 23 | ]; |
| 18 | 24 | |
| 19 | - const OPT_OUT_FEATURES = [ | |
| 25 | + const OPT_IN_FEATURES = [ | |
| 20 | 26 | self::EXPERIMENT_NAME, |
| 27 | + 'container', | |
| 28 | + NestedElementsModule::EXPERIMENT_NAME, | |
| 21 | 29 | AtomicWidgetsModule::EXPERIMENT_NAME, |
| 30 | + GlobalClassesModule::NAME, | |
| 31 | + VariablesModule::EXPERIMENT_NAME, | |
| 32 | + ComponentsModule::EXPERIMENT_NAME, | |
| 22 | 33 | ]; |
| 23 | 34 | |
| 24 | - | |
| 25 | 35 | public function init() { |
| 26 | 36 | $this->register_feature(); |
| 27 | 37 | |
| 28 | 38 | add_action( 'elementor/ajax/register_actions', fn( Ajax $ajax ) => $this->add_ajax_actions( $ajax ) ); |
| 29 | - add_action( 'rest_api_init', fn() => $this->register_routes() ); | |
| 30 | 39 | } |
| 31 | 40 | |
| 32 | 41 | private function register_feature() { |
| 33 | 42 | Plugin::$instance->experiments->add_feature([ |
| @@ -36,12 +45,8 @@ | ||
| 36 | 45 | 'description' => esc_html__( 'Enable Editor V4.', 'elementor' ), |
| 37 | 46 | 'hidden' => true, |
| 38 | 47 | 'default' => Experiments_Manager::STATE_INACTIVE, |
| 39 | 48 | 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA, |
| 40 | - 'new_site' => [ | |
| 41 | - 'default_active' => true, | |
| 42 | - 'minimum_installation_version' => '4.0.0', | |
| 43 | - ], | |
| 44 | 49 | ]); |
| 45 | 50 | } |
| 46 | 51 | |
| 47 | 52 | private function opt_out_v4() { |
| @@ -76,21 +81,6 @@ | ||
| 76 | 81 | |
| 77 | 82 | private function add_ajax_actions( Ajax $ajax ) { |
| 78 | 83 | $ajax->register_ajax_action( 'editor_v4_opt_in', fn() => $this->ajax_opt_in_v4() ); |
| 79 | 84 | $ajax->register_ajax_action( 'editor_v4_opt_out', fn() => $this->ajax_opt_out_v4() ); |
| 80 | - } | |
| 81 | - | |
| 82 | - private function handle_rest_opt_in_v4() { | |
| 83 | - $this->ajax_opt_in_v4(); | |
| 84 | - return new \WP_REST_Response( [ | |
| 85 | - 'success' => true, | |
| 86 | - ], 200 ); | |
| 87 | - } | |
| 88 | - | |
| 89 | - private function register_routes() { | |
| 90 | - register_rest_route( 'elementor/v1', '/operations/opt-in-v4', [ | |
| 91 | - 'methods' => 'POST', | |
| 92 | - 'callback' => fn() => $this->handle_rest_opt_in_v4(), | |
| 93 | - 'permission_callback' => fn() => current_user_can( 'manage_options' ), | |
| 94 | - ] ); | |
| 95 | 85 | } |
| 96 | 86 | } |