PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.0-beta1
Elementor Website Builder – more than just a page builder v4.1.0-beta1
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 4.1.0-beta2 All 456 releases
← All changes | modules/variables/classes/size-style-schema.php +22 -16 4.0.9 → 4.1.0-beta1 View file →
@@ -5,8 +5,9 @@
5 5 use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type;
6 6 use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type;
7 7 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
8 8 use Elementor\Modules\AtomicWidgets\PropTypes\Union_Prop_Type;
9 +use Elementor\Modules\AtomicWidgets\Styles\Size_Constants;
9 10 use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
10 11
11 12 if ( ! defined( 'ABSPATH' ) ) {
12 13 exit; // Exit if accessed directly.
@@ -12,30 +13,31 @@
12 13 exit; // Exit if accessed directly.
13 14 }
14 15
15 16 class Size_Style_Schema {
16 - private $blacklist = [
17 - 'box-shadow',
18 - 'filter',
19 - 'backdrop-filter',
20 - 'transform',
21 - 'transition',
22 - ];
17 + private $units_to_skip = [];
23 18
24 - private function ignore( $css_property ): bool {
25 - if ( in_array( $css_property, $this->blacklist, true ) ) {
26 - return true;
19 + public function __construct() {
20 + $this->units_to_skip = [
21 + ...Size_Constants::angle(),
22 + ...Size_Constants::time(),
23 + ];
24 + }
25 +
26 + private function skip_by_units( Size_Prop_Type $size_prop_type ) {
27 + $settings = $size_prop_type->get_settings();
28 +
29 + if ( ! array_key_exists( 'available_units', $settings ) ) {
30 + return false;
27 31 }
28 32
29 - return false;
33 + $available_units = $settings['available_units'];
34 +
35 + return count( array_intersect( $available_units, $this->units_to_skip ) ) > 0;
30 36 }
31 37
32 38 public function augment( array $schema ): array {
33 39 foreach ( $schema as $css_property => $prop_type ) {
34 - if ( $this->ignore( $css_property ) ) {
35 - continue;
36 - }
37 -
38 40 $schema[ $css_property ] = $this->update( $prop_type );
39 41 }
40 42
41 43 return $schema;
@@ -60,9 +62,13 @@
60 62
61 63 return $prop_type;
62 64 }
63 65
64 - private function update_size( Size_Prop_Type $size_prop_type ): Union_Prop_Type {
66 + private function update_size( Size_Prop_Type $size_prop_type ) {
67 + if ( $this->skip_by_units( $size_prop_type ) ) {
68 + return $size_prop_type;
69 + }
70 +
65 71 return Union_Prop_Type::create_from( $size_prop_type )
66 72 ->add_prop_type( Size_Variable_Prop_Type::make() );
67 73 }
68 74