PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4.2
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / framework / blocks-style-manager / field-handlers / typography.php
jetformbuilder / modules / framework / blocks-style-manager / field-handlers Last commit date
base.php 3 months ago border.php 3 months ago dimensions.php 3 months ago range.php 3 months ago typography.php 3 months ago
typography.php
74 lines
1 <?php
2 namespace Crocoblock\Blocks_Style\Field_Handlers;
3
4 class Typography extends Base {
5
6 /**
7 * Replace data in the string with CSS variable macros.
8 *
9 * @param string $string String with macros.
10 * @param array $data Data to replace in the string.
11 *
12 * @return array
13 */
14 public function parse_variable( $variable = array() ) {
15
16 $prefix = isset($variable['prefix']) ? $variable['prefix'] : '';
17 $name = isset($variable['name']) ? $variable['name'] : false;
18 $full_name = isset($variable['full_name']) ? $variable['full_name'] : $prefix . '-' . $name;
19
20 if ( ! $full_name ) {
21 return array();
22 }
23
24 if ( isset( $variable['suffix'] ) ) {
25 $full_name .= $variable['suffix'];
26 }
27
28 $parsed_values = $this->get_parsed_value();
29 $result = array();
30 $skip_keys = array( 'lh_unit', 'ls_unit', 's_unit' );
31
32 foreach ( $parsed_values as $key => $value ) {
33
34 if ( in_array( $key, $skip_keys, true ) ) {
35 continue; // Skip legacy units.
36 }
37
38 if ( 'inherit' === $value ) {
39 continue; // Skip inherit values.
40 }
41
42 $result[] = $full_name . '__' . $key . ':'. $value;
43 }
44
45 return $result;
46 }
47
48 /**
49 * Get the parsed value.
50 *
51 * @return array
52 */
53 public function get_parsed_value() {
54
55 if ( isset( $this->raw_value['lineHeight'] ) ) {
56 $this->raw_value['lineheight'] = $this->raw_value['lineHeight'];
57 }
58
59 return [
60 'family' => isset($this->raw_value['family']) ? $this->raw_value['family'] : 'inherit',
61 'weight' => isset($this->raw_value['weight']) ? $this->raw_value['weight'] : 'inherit',
62 'transform' => isset($this->raw_value['transform']) ? $this->raw_value['transform'] : 'inherit',
63 'style' => isset($this->raw_value['style']) ? $this->raw_value['style'] : 'inherit',
64 'decoration' => isset($this->raw_value['decoration']) ? $this->raw_value['decoration'] : 'inherit',
65 'lineheight' => isset($this->raw_value['lineheight']) ? $this->raw_value['lineheight'] : 'inherit',
66 'lh_unit' => '', // legacy from old SM for style decorations consistency
67 'letterspacing' => isset($this->raw_value['letterSpacing']) ? $this->raw_value['letterSpacing'] : 'inherit',
68 'ls_unit' => '', // legacy from old SM for style decorations consistency
69 'size' => isset($this->raw_value['size']) ? $this->raw_value['size'] : 'inherit',
70 's_unit' => '', // legacy from old SM for style decorations consistency
71 ];
72 }
73 }
74