PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.2
Elementor Website Builder – more than just a page builder v3.19.2
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 4.0.7 All 451 releases
← All changes | modules/styleguide/module.php +24 -11 4.0.93.19.2 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,22 @@
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 + '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' ),
62 + 'default' => Experiments_Manager::STATE_ACTIVE,
63 + 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE,
64 + ];
65 + }
66 +
50 67 /**
51 68 * Enqueue scripts.
52 69 *
53 70 * @return void
@@ -65,10 +82,8 @@
65 82
66 83 wp_localize_script( static::ASSETS_HANDLE, 'elementorStyleguideConfig', [
67 84 'activeKitId' => $kit_id,
68 85 ] );
69 -
70 - wp_set_script_translations( static::ASSETS_HANDLE, 'elementor' );
71 86 }
72 87
73 88 public function enqueue_app_initiator( $is_preview = false ) {
74 89 $dependencies = [
@@ -87,16 +102,14 @@
87 102 $dependencies,
88 103 ELEMENTOR_VERSION,
89 104 true
90 105 );
91 -
92 - wp_set_script_translations( static::ASSETS_HANDLE . '-app-initiator', 'elementor' );
93 106 }
94 107
95 108 public function enqueue_styles() {
96 109 wp_enqueue_style(
97 110 static::ASSETS_HANDLE,
98 - $this->get_css_assets_url( 'modules/styleguide/editor' ),
111 + $this->get_css_assets_url( 'modules/' . static::ASSETS_SRC . '/' . static::ASSETS_SRC ),
99 112 [],
100 113 ELEMENTOR_VERSION
101 114 );
102 115 }
@@ -111,9 +124,9 @@
111 124 * Add the Enable Styleguide Preview controls to Global Colors and Global Fonts.
112 125 *
113 126 * @param $element
114 127 * @param string $section_id
115 - * @param array $args
128 + * @param array $args
116 129 */
117 130 public function add_styleguide_enable_controls( $element, $section_id, $args ) {
118 131 if ( 'kit' !== $element->get_name() || ! in_array( $section_id, [ 'section_global_colors', 'section_text_style' ] ) ) {
119 132 return;
@@ -123,14 +136,14 @@
123 136
124 137 $element->add_control(
125 138 $control_name,
126 139 [
127 - 'label' => esc_html__( 'Show global settings', 'elementor' ),
140 + 'label' => esc_html__( 'Style Guide Preview', 'elementor' ),
128 141 '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' ),
142 + 'description' => esc_html__( 'Switch between the content area and style guide to preview your changes to global colors.', 'elementor' ),
130 143 'separator' => 'after',
131 - 'label_off' => esc_html__( 'No', 'elementor' ),
132 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
144 + 'label_off' => esc_html__( 'Off', 'elementor' ),
145 + 'label_on' => esc_html__( 'On', 'elementor' ),
133 146 'on_change_command' => true,
134 147 ]
135 148 );
136 149 }