| @@ -1,23 +1,21 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Variables\Classes; |
| 4 | 4 | |
| 5 | -use Elementor\Modules\Variables\Services\Variables_Service; | |
| 6 | - | |
| 7 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 6 | exit; // Exit if accessed directly. |
| 9 | 7 | } |
| 10 | 8 | |
| 11 | 9 | class CSS_Renderer { |
| 12 | - private Variables_Service $service; | |
| 10 | + private Variables $variables; | |
| 13 | 11 | |
| 14 | - public function __construct( Variables_Service $service ) { | |
| 15 | - $this->service = $service; | |
| 12 | + public function __construct( Variables $variables ) { | |
| 13 | + $this->variables = $variables; | |
| 16 | 14 | } |
| 17 | 15 | |
| 18 | 16 | private function global_variables(): array { |
| 19 | - return $this->service->get_variables_list(); | |
| 17 | + return $this->variables->get_all(); | |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | 20 | public function raw_css(): string { |
| 23 | 21 | $list_of_variables = $this->global_variables(); |
| @@ -52,13 +50,8 @@ | ||
| 52 | 50 | } |
| 53 | 51 | |
| 54 | 52 | private function build_css_variable_entry( string $id, array $variable ): ?string { |
| 55 | 53 | $variable_name = sanitize_text_field( $id ); |
| 56 | - | |
| 57 | - if ( ! array_key_exists( 'deleted_at', $variable ) ) { | |
| 58 | - $variable_name = sanitize_text_field( $variable['label'] ?? '' ); | |
| 59 | - } | |
| 60 | - | |
| 61 | 54 | $value = sanitize_text_field( $variable['value'] ?? '' ); |
| 62 | 55 | |
| 63 | 56 | if ( empty( $value ) || empty( $variable_name ) ) { |
| 64 | 57 | return null; |
| @@ -63,13 +56,9 @@ | ||
| 63 | 56 | if ( empty( $value ) || empty( $variable_name ) ) { |
| 64 | 57 | return null; |
| 65 | 58 | } |
| 66 | 59 | |
| 67 | - $entry = "--{$variable_name}:{$value};"; | |
| 68 | - | |
| 69 | - $additional = apply_filters( 'elementor/variables/css_entry_additional', '', $variable, $id ); | |
| 70 | - | |
| 71 | - return $entry . $additional; | |
| 60 | + return "--{$variable_name}:{$value};"; | |
| 72 | 61 | } |
| 73 | 62 | |
| 74 | 63 | private function wrap_with_root( array $css_entries ): string { |
| 75 | 64 | return ':root { ' . implode( ' ', $css_entries ) . ' }'; |