← All changes
|
modules/atomic-widgets/props-resolver/render-props-resolver.php
+1
-23
4.2.0-beta2
→
3.32.3
View file →
| @@ -1,14 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\AtomicWidgets\PropsResolver; |
| 4 | 4 | |
| 5 | -use Elementor\Modules\AtomicWidgets\DynamicTags\Dynamic_Prop_Type; | |
| 6 | 5 | use Elementor\Modules\AtomicWidgets\PropTypes\Base\Array_Prop_Type; |
| 7 | 6 | use Elementor\Modules\AtomicWidgets\PropTypes\Base\Object_Prop_Type; |
| 8 | 7 | use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type; |
| 9 | 8 | use Elementor\Modules\AtomicWidgets\PropTypes\Union_Prop_Type; |
| 10 | -use Elementor\Plugin; | |
| 11 | 9 | use Exception; |
| 12 | 10 | |
| 13 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 12 | exit; // Exit if accessed directly. |
| @@ -40,13 +38,10 @@ | ||
| 40 | 38 | if ( ! ( $prop_type instanceof Prop_Type ) ) { |
| 41 | 39 | continue; |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - $prop_value = $props[ $key ] ?? null; | |
| 45 | - $actual_value = $this->get_validated_value( $prop_type, $prop_value ); | |
| 46 | - | |
| 47 | 42 | $transformed = $this->resolve_item( |
| 48 | - $actual_value, | |
| 43 | + $props[ $key ] ?? $prop_type->get_default(), | |
| 49 | 44 | $key, |
| 50 | 45 | $prop_type |
| 51 | 46 | ); |
| 52 | 47 | |
| @@ -81,23 +76,6 @@ | ||
| 81 | 76 | |
| 82 | 77 | $transformed = $this->transform( $value, $key, $prop_type ); |
| 83 | 78 | |
| 84 | 79 | return $this->resolve_item( $transformed, $key, $prop_type, $depth + 1 ); |
| 85 | - } | |
| 86 | - | |
| 87 | - private function get_validated_value( Prop_Type $prop_type, $prop_value ) { | |
| 88 | - $default = $prop_type->get_default() ?? null; | |
| 89 | - | |
| 90 | - if ( null === $prop_value ) { | |
| 91 | - return $default; | |
| 92 | - } | |
| 93 | - | |
| 94 | - if ( ! Dynamic_Prop_Type::is_dynamic_prop_value( $prop_value ) ) { | |
| 95 | - return $prop_value; | |
| 96 | - } | |
| 97 | - | |
| 98 | - $tag_name = $prop_value['value']['name'] ?? null; | |
| 99 | - $tag = Plugin::$instance->dynamic_tags->get_tag_info( $tag_name ); | |
| 100 | - | |
| 101 | - return ! $tag ? $default : $prop_value; | |
| 102 | 80 | } |
| 103 | 81 | } |