PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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/variables/classes/size-style-schema.php +38 -16 4.0.84.3.0-beta3 View file →
@@ -3,11 +3,14 @@
3 3 namespace Elementor\Modules\Variables\Classes;
4 4
5 5 use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type;
6 6 use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
7 +use Elementor\Modules\AtomicWidgets\PropTypes\Grid_Track_Size_Prop_Type;
7 8 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
8 9 use Elementor\Modules\AtomicWidgets\PropTypes\Union_Prop_Type;
10 +use Elementor\Modules\AtomicWidgets\Styles\Size_Constants;
9 11 use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
12 +use Elementor\Utils as ElementorUtils;
10 13
11 14 if ( ! defined( 'ABSPATH' ) ) {
12 15 exit; // Exit if accessed directly.
13 16 }
@@ -12,30 +15,33 @@
12 15 exit; // Exit if accessed directly.
13 16 }
14 17
15 18 class Size_Style_Schema {
16 - private $blacklist = [
17 - 'box-shadow',
18 - 'filter',
19 - 'backdrop-filter',
20 - 'transform',
21 - 'transition',
22 - ];
19 + private const PRO_VERSION_FOR_GRID_TRACK_VARIABLES = '4.2';
23 20
24 - private function ignore( $css_property ): bool {
25 - if ( in_array( $css_property, $this->blacklist, true ) ) {
26 - return true;
21 + private $units_to_skip = [];
22 +
23 + public function __construct() {
24 + $this->units_to_skip = [
25 + ...Size_Constants::angle(),
26 + ...Size_Constants::time(),
27 + ];
28 + }
29 +
30 + private function skip_by_units( Size_Prop_Type $size_prop_type ) {
31 + $settings = $size_prop_type->get_settings();
32 +
33 + if ( ! array_key_exists( 'available_units', $settings ) ) {
34 + return false;
27 35 }
28 36
29 - return false;
37 + $available_units = $settings['available_units'];
38 +
39 + return count( array_intersect( $available_units, $this->units_to_skip ) ) > 0;
30 40 }
31 41
32 42 public function augment( array $schema ): array {
33 43 foreach ( $schema as $css_property => $prop_type ) {
34 - if ( $this->ignore( $css_property ) ) {
35 - continue;
36 - }
37 -
38 44 $schema[ $css_property ] = $this->update( $prop_type );
39 45 }
40 46
41 47 return $schema;
@@ -60,11 +66,27 @@
60 66
61 67 return $prop_type;
62 68 }
63 69
64 - private function update_size( Size_Prop_Type $size_prop_type ): Union_Prop_Type {
70 + private function update_size( Size_Prop_Type $size_prop_type ) {
71 + if ( $this->skip_by_units( $size_prop_type ) ) {
72 + return $size_prop_type;
73 + }
74 +
75 + if (
76 + $size_prop_type instanceof Grid_Track_Size_Prop_Type
77 + && ! $this->is_grid_track_variables_supported_by_pro()
78 + ) {
79 + return $size_prop_type;
80 + }
81 +
65 82 return Union_Prop_Type::create_from( $size_prop_type )
66 83 ->add_prop_type( Size_Variable_Prop_Type::make() );
84 + }
85 +
86 + private function is_grid_track_variables_supported_by_pro(): bool {
87 + return ElementorUtils::has_pro()
88 + && version_compare( ELEMENTOR_PRO_VERSION, self::PRO_VERSION_FOR_GRID_TRACK_VARIABLES, '>=' );
67 89 }
68 90
69 91 private function update_array( Array_Prop_Type $array_prop_type ): Array_Prop_Type {
70 92 return $array_prop_type->set_item_type(