PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.5
Elementor Website Builder – more than just a page builder v3.7.5
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 | core/files/css/post.php +6 -85 4.3.0-beta33.7.5 View file →
@@ -1,11 +1,10 @@
1 1 <?php
2 2 namespace Elementor\Core\Files\CSS;
3 3
4 +use Elementor\Base_Data_Control;
5 +use Elementor\Control_Repeater;
4 6 use Elementor\Controls_Stack;
5 -use Elementor\Core\DynamicTags\Dynamic_CSS;
6 -use Elementor\Core\Kits\Manager;
7 -use Elementor\Core\Frontend\Widget_Content_Render_Mode;
8 7 use Elementor\Element_Base;
9 8 use Elementor\Plugin;
10 9
11 10 if ( ! defined( 'ABSPATH' ) ) {
@@ -218,9 +217,9 @@
218 217 * @param array $placeholders Placeholders.
219 218 * @param array $replacements Replacements.
220 219 * @param array $all_controls All controls.
221 220 */
222 - public function add_controls_stack_style_rules( Controls_Stack $controls_stack, array $controls, array $values, array $placeholders, array $replacements, ?array $all_controls = null ) {
221 + public function add_controls_stack_style_rules( Controls_Stack $controls_stack, array $controls, array $values, array $placeholders, array $replacements, array $all_controls = null ) {
223 222 parent::add_controls_stack_style_rules( $controls_stack, $controls, $values, $placeholders, $replacements, $all_controls );
224 223
225 224 if ( $controls_stack instanceof Element_Base ) {
226 225 foreach ( $controls_stack->get_children() as $child_element ) {
@@ -281,12 +280,8 @@
281 280 *
282 281 * @param Element_Base $element The element.
283 282 */
284 283 protected function render_styles( Element_Base $element ) {
285 - if ( Widget_Content_Render_Mode::is( Widget_Content_Render_Mode::MARKDOWN ) ) {
286 - return;
287 - }
288 -
289 284 /**
290 285 * Before element parse CSS.
291 286 *
292 287 * Fires before the CSS of the element is parsed.
@@ -297,11 +292,12 @@
297 292 * @param Element_Base $element The element.
298 293 */
299 294 do_action( 'elementor/element/before_parse_css', $this, $element );
300 295
301 - $this->render_element_global_styles( $element );
302 - $this->render_element_styles( $element );
296 + $element_settings = $element->get_settings();
303 297
298 + $this->add_controls_stack_style_rules( $element, $this->get_style_controls( $element, null, $element->get_parsed_dynamic_settings() ), $element_settings, [ '{{ID}}', '{{WRAPPER}}' ], [ $element->get_id(), $this->get_element_unique_selector( $element ) ] );
299 +
304 300 /**
305 301 * After element parse CSS.
306 302 *
307 303 * Fires after the CSS of the element is parsed.
@@ -311,81 +307,6 @@
311 307 * @param Post $this The post CSS file.
312 308 * @param Element_Base $element The element.
313 309 */
314 310 do_action( 'elementor/element/parse_css', $this, $element );
315 - }
316 -
317 - private function render_element_styles( Element_Base $element ) {
318 - $this->add_controls_stack_style_rules(
319 - $element,
320 - $this->get_style_controls( $element, null, $element->get_parsed_dynamic_settings() ),
321 - $element->get_settings(),
322 - [ '{{ID}}', '{{WRAPPER}}' ],
323 - [ $element->get_id(), $this->get_element_unique_selector( $element ) ]
324 - );
325 - }
326 -
327 - private function render_element_global_styles( Element_Base $element ) {
328 - if ( $this instanceof Dynamic_CSS ) {
329 - return;
330 - }
331 -
332 - /** @var Manager $module */
333 - $kits_manager = Plugin::$instance->kits_manager;
334 - $custom_colors_enabled = $kits_manager->is_custom_colors_enabled();
335 - $custom_typography_enabled = $kits_manager->is_custom_typography_enabled();
336 -
337 - $controls = $element->get_controls();
338 - $global_controls = [];
339 - $global_values['__globals__'] = [];
340 -
341 - foreach ( $controls as $control ) {
342 - $this->build_global_controls_and_values(
343 - $control,
344 - $controls,
345 - $global_controls,
346 - $global_values,
347 - $custom_colors_enabled,
348 - $custom_typography_enabled
349 - );
350 - }
351 -
352 - foreach ( $global_controls as $control ) {
353 - $this->add_control_rules(
354 - $control,
355 - $controls,
356 - function( $control ) {},
357 - [ '{{WRAPPER}}' ],
358 - [ '.elementor-widget-' . $element->get_name() ],
359 - $global_values
360 - );
361 - }
362 - }
363 -
364 - private function build_global_controls_and_values( $control, $controls, &$global_controls, &$global_values, $custom_colors_enabled, $custom_typography_enabled ) {
365 - $is_color_control = 'color' === $control['type'];
366 - $is_typography_control = isset( $control['groupType'] ) && 'typography' === $control['groupType'];
367 -
368 - // If it is a color/typography control and default colors/typography are disabled,
369 - // don't add the default CSS.
370 - if ( ( $is_color_control && ! $custom_colors_enabled ) || ( $is_typography_control && ! $custom_typography_enabled ) ) {
371 - return;
372 - }
373 -
374 - $global_control = $control;
375 -
376 - // Handle group controls that don't have a default global property.
377 - if ( ! empty( $control['groupType'] ) ) {
378 - $global_control = $controls[ $control['groupPrefix'] . $control['groupType'] ];
379 - }
380 -
381 - // If the control has a default global defined, add it to the globals array
382 - // that is used in add_control_rules.
383 - if ( ! empty( $control['global']['default'] ) ) {
384 - $global_values['__globals__'][ $control['name'] ] = $global_control['global']['default'];
385 - }
386 -
387 - if ( ! empty( $global_control['global']['default'] ) ) {
388 - $global_controls[] = $control;
389 - }
390 311 }
391 312 }