PluginProbe
Elementor Website Builder – more than just a page builder / 3.14.0-beta4
Elementor Website Builder – more than just a page builder v3.14.0-beta4
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 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 All 457 releases
← All changes | modules/styleguide/module.php +25 -11 4.1.3 → 3.14.0-beta4 View file →
@@ -1,13 +1,14 @@
1 1 <?php
2 2 namespace Elementor\Modules\Styleguide;
3 3
4 4 use Elementor\Core\Base\Module as Base_Module;
5 +use Elementor\Core\Experiments\Manager as Experiments_Manager;
5 6 use Elementor\Plugin;
6 7 use Elementor\Modules\Styleguide\Controls\Switcher;
7 8
8 9 if ( ! defined( 'ABSPATH' ) ) {
9 - exit; // Exit if accessed directly.
10 + exit; // Exit if accessed directly
10 11 }
11 12
12 13 class Module extends Base_Module {
13 14
@@ -13,8 +14,10 @@
13 14
14 15 const ASSETS_HANDLE = 'elementor-styleguide';
15 16 const ASSETS_SRC = 'styleguide';
16 17
18 + const EXPERIMENT_NAME = 'e_global_styleguide';
19 +
17 20 /**
18 21 * Initialize the Container-Converter module.
19 22 *
20 23 * @return void
@@ -46,8 +49,23 @@
46 49 public function get_name() {
47 50 return 'styleguide';
48 51 }
49 52
53 + public static function is_active() {
54 + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME );
55 + }
56 +
57 + public static function get_experimental_data() {
58 + return [
59 + 'name' => static::EXPERIMENT_NAME,
60 + 'title' => esc_html__( 'Global Style Guide', 'elementor' ),
61 + 'tag' => esc_html__( 'Feature', 'elementor' ), //todo : add tag
62 + 'description' => esc_html__( 'Display a live preview of changes to global colors and fonts in a sleek style guide from the site’s settings. You will be able to toggle between the style guide and the page to see your changes in action.', 'elementor' ),
63 + 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA,
64 + 'default' => Experiments_Manager::STATE_INACTIVE,
65 + ];
66 + }
67 +
50 68 /**
51 69 * Enqueue scripts.
52 70 *
53 71 * @return void
@@ -65,10 +83,8 @@
65 83
66 84 wp_localize_script( static::ASSETS_HANDLE, 'elementorStyleguideConfig', [
67 85 'activeKitId' => $kit_id,
68 86 ] );
69 -
70 - wp_set_script_translations( static::ASSETS_HANDLE, 'elementor' );
71 87 }
72 88
73 89 public function enqueue_app_initiator( $is_preview = false ) {
74 90 $dependencies = [
@@ -87,16 +103,14 @@
87 103 $dependencies,
88 104 ELEMENTOR_VERSION,
89 105 true
90 106 );
91 -
92 - wp_set_script_translations( static::ASSETS_HANDLE . '-app-initiator', 'elementor' );
93 107 }
94 108
95 109 public function enqueue_styles() {
96 110 wp_enqueue_style(
97 111 static::ASSETS_HANDLE,
98 - $this->get_css_assets_url( 'modules/styleguide/editor' ),
112 + $this->get_css_assets_url( 'modules/' . static::ASSETS_SRC . '/' . static::ASSETS_SRC ),
99 113 [],
100 114 ELEMENTOR_VERSION
101 115 );
102 116 }
@@ -111,9 +125,9 @@
111 125 * Add the Enable Styleguide Preview controls to Global Colors and Global Fonts.
112 126 *
113 127 * @param $element
114 128 * @param string $section_id
115 - * @param array $args
129 + * @param array $args
116 130 */
117 131 public function add_styleguide_enable_controls( $element, $section_id, $args ) {
118 132 if ( 'kit' !== $element->get_name() || ! in_array( $section_id, [ 'section_global_colors', 'section_text_style' ] ) ) {
119 133 return;
@@ -123,14 +137,14 @@
123 137
124 138 $element->add_control(
125 139 $control_name,
126 140 [
127 - 'label' => esc_html__( 'Show global settings', 'elementor' ),
141 + 'label' => esc_html__( 'Style Guide Preview', 'elementor' ),
128 142 'type' => Switcher::CONTROL_TYPE,
129 - 'description' => esc_html__( 'Temporarily overlay the canvas with the style guide to preview your changes to global colors and fonts.', 'elementor' ),
143 + 'description' => esc_html__( 'Switch between the content area and style guide to preview your changes to global colors.', 'elementor' ),
130 144 'separator' => 'after',
131 - 'label_off' => esc_html__( 'No', 'elementor' ),
132 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
145 + 'label_off' => esc_html__( 'Off', 'elementor' ),
146 + 'label_on' => esc_html__( 'On', 'elementor' ),
133 147 'on_change_command' => true,
134 148 ]
135 149 );
136 150 }