PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.0
Elementor Website Builder – more than just a page builder v4.2.0
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 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / variables / classes / fonts.php

fonts.php in Elementor Website Builder – more than just a page builder 4.2.0, at modules/variables/classes/fonts.php

45 lines 1005 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Variables\Classes;
4
5 use Elementor\Modules\Variables\Services\Variables_Service;
6 use Elementor\Plugin;
7 use Elementor\Core\Files\CSS\Post as Post_CSS;
8 use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 class Fonts {
15 private Variables_Service $service;
16
17 public function __construct( Variables_Service $service ) {
18 $this->service = $service;
19 }
20
21 public function append_to( Post_CSS $post_css ) {
22 if ( ! Plugin::$instance->kits_manager->is_kit( $post_css->get_post_id() ) ) {
23 return;
24 }
25
26 $list_of_variables = $this->service->get_variables_list();
27
28 foreach ( $list_of_variables as $variable ) {
29 if ( Font_Variable_Prop_Type::get_key() !== $variable['type'] ) {
30 continue;
31 }
32
33 $font_family = sanitize_text_field( $variable['value'] ?? '' );
34
35 if ( empty( $font_family ) ) {
36 continue;
37 }
38
39 $post_css->add_font( $font_family );
40 }
41
42 return $this;
43 }
44 }
45