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