← All changes
|
modules/variables/transformers/global-variable-transformer.php
+3
-24
4.3.0-beta3
→
3.30.1
View file →
| @@ -1,12 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Variables\Transformers; |
| 4 | 4 | |
| 5 | -use Elementor\Modules\AtomicWidgets\PropsResolver\Props_Resolver_Context; | |
| 6 | 5 | use Elementor\Modules\AtomicWidgets\PropsResolver\Transformer_Base; |
| 7 | -use Elementor\Modules\AtomicWidgets\Styles\Grid_Track_Renderer; | |
| 8 | -use Elementor\Modules\Variables\Classes\Variables; | |
| 9 | 6 | |
| 10 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 8 | exit; // Exit if accessed directly. |
| 12 | 9 | } |
| @@ -11,30 +8,12 @@ | ||
| 11 | 8 | exit; // Exit if accessed directly. |
| 12 | 9 | } |
| 13 | 10 | |
| 14 | 11 | class Global_Variable_Transformer extends Transformer_Base { |
| 15 | - public function transform( $value, Props_Resolver_Context $context ) { | |
| 16 | - $variable = Variables::by_id( $value ); | |
| 17 | - | |
| 18 | - if ( ! $variable ) { | |
| 12 | + public function transform( $value, $key ) { | |
| 13 | + if ( ! trim( $value ) ) { | |
| 19 | 14 | return null; |
| 20 | 15 | } |
| 21 | 16 | |
| 22 | - if ( Grid_Track_Renderer::is_grid_track_property( $context->get_key() ) ) { | |
| 23 | - $count = (int) trim( $variable['value'] ?? '' ); | |
| 24 | - | |
| 25 | - return Grid_Track_Renderer::format_repeat( $count ); | |
| 26 | - } | |
| 27 | - | |
| 28 | - if ( array_key_exists( 'deleted', $variable ) && $variable['deleted'] ) { | |
| 29 | - return "var(--{$value})"; | |
| 30 | - } | |
| 31 | - | |
| 32 | - $identifier = trim( $variable['label'] ?? '' ); | |
| 33 | - | |
| 34 | - if ( '' === $identifier ) { | |
| 35 | - return null; | |
| 36 | - } | |
| 37 | - | |
| 38 | - return "var(--{$identifier})"; | |
| 17 | + return "var(--{$value})"; | |
| 39 | 18 | } |
| 40 | 19 | } |