PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.8
Elementor Website Builder – more than just a page builder v4.0.8
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/widget-creation/module.php +17 -17 4.3.0-beta34.0.8 View file →
@@ -2,12 +2,11 @@
2 2
3 3 namespace Elementor\Modules\WidgetCreation;
4 4
5 5 use Elementor\Core\Base\Module as BaseModule;
6 -use Elementor\Core\Experiments\Manager as Experiments_Manager;
6 +use Elementor\Core\Experiments\Manager as ExperimentsManager;
7 7 use Elementor\Core\Utils\Hints;
8 8 use Elementor\Elements_Manager;
9 -use Elementor\Modules\AtomicWidgets\Module as Atomic_Widgets_Module;
10 9 use Elementor\Plugin;
11 10
12 11 if ( ! defined( 'ABSPATH' ) ) {
13 12 exit;
@@ -13,11 +12,10 @@
13 12 exit;
14 13 }
15 14
16 15 class Module extends BaseModule {
17 - const EXPERIMENT_NAME = Atomic_Widgets_Module::EXPERIMENT_NAME;
18 - const ANGIE_IN_PANELS_EXPERIMENT_NAME = 'e_angie_in_panels';
19 16 const MODULE_NAME = 'widget-creation';
17 + const EXPERIMENT_NAME = 'e_widget_creation';
20 18
21 19 const PACKAGES = [
22 20 'editor-widget-creation',
23 21 ];
@@ -27,23 +25,21 @@
27 25 public function get_name() {
28 26 return self::MODULE_NAME;
29 27 }
30 28
31 - public static function get_angie_in_panels_experimental_data(): array {
29 + public static function get_experimental_data(): array {
32 30 return [
33 - 'name' => self::ANGIE_IN_PANELS_EXPERIMENT_NAME,
34 - 'title' => esc_html__( 'Angie in editor panels', 'elementor' ),
35 - 'description' => esc_html__( 'Load Angie inside the native Elementor editor panel instead of the legacy push sidebar.', 'elementor' ),
31 + 'name' => self::EXPERIMENT_NAME,
32 + 'title' => esc_html__( 'Widget Creation', 'elementor' ),
33 + 'description' => esc_html__( 'Promote widget creation with Angie plugin.', 'elementor' ),
36 34 'hidden' => true,
37 - 'default' => Experiments_Manager::STATE_INACTIVE,
38 - 'release_status' => Experiments_Manager::RELEASE_STATUS_DEV,
35 + 'default' => ExperimentsManager::STATE_ACTIVE,
36 + 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
39 37 ];
40 38 }
41 39
42 40 public function __construct() {
43 41 parent::__construct();
44 - $this->register_angie_in_panels_experiment();
45 - AngiePromotion::init();
46 42
47 43 add_filter( 'elementor/editor/v2/packages', fn( $packages ) => $this->add_packages( $packages ) );
48 44 add_action( 'elementor/elements/categories_registered', [ $this, 'maybe_register_custom_widgets_category_fallback' ], 100 );
49 45 add_action( 'rest_api_init', fn() => $this->register_consent_route() );
@@ -48,12 +44,8 @@
48 44 add_action( 'elementor/elements/categories_registered', [ $this, 'maybe_register_custom_widgets_category_fallback' ], 100 );
49 45 add_action( 'rest_api_init', fn() => $this->register_consent_route() );
50 46 }
51 47
52 - private function register_angie_in_panels_experiment(): void {
53 - Plugin::$instance->experiments->add_feature( self::get_angie_in_panels_experimental_data() );
54 - }
55 -
56 48 private function register_consent_route(): void {
57 49 register_rest_route( 'elementor/v1', '/angie/consent', [
58 50 'methods' => 'POST',
59 51 'callback' => fn() => $this->handle_save_consent(),
@@ -67,8 +59,12 @@
67 59 return new \WP_REST_Response( [ 'success' => true ], 200 );
68 60 }
69 61
70 62 public function maybe_register_custom_widgets_category_fallback( Elements_Manager $elements_manager ): void {
63 + if ( ! Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) ) {
64 + return;
65 + }
66 +
71 67 if ( Hints::is_plugin_active( 'angie' ) ) {
72 68 return;
73 69 }
74 70
@@ -92,9 +88,9 @@
92 88 add_action( 'elementor/editor/templates/panel/category/content', [ $this, 'render_custom_widgets_category_empty_state' ] );
93 89 }
94 90
95 91 public function render_custom_widgets_category_heading_cta(): void {
96 - if ( ! current_user_can( 'manage_options' ) ) {
92 + if ( ! Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) ) {
97 93 return;
98 94 }
99 95
100 96 ?>
@@ -104,8 +100,12 @@
104 100 <?php
105 101 }
106 102
107 103 public function render_custom_widgets_category_empty_state(): void {
104 + if ( ! Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) ) {
105 + return;
106 + }
107 +
108 108 if ( $this->custom_widgets_category_has_widgets() ) {
109 109 return;
110 110 }
111 111