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