PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / customizer / packages / controls / margin-padding / src / Field / CSS / Margin.php
kirki / customizer / packages / controls / margin-padding / src / Field / CSS Last commit date
Margin.php 5 months ago Padding.php 5 months ago
Margin.php
73 lines
1 <?php
2 /**
3 * Handle CSS output for margin control.
4 *
5 * @package Kirki
6 * @subpackage Controls
7 * @since 1.0.0
8 */
9
10 namespace Kirki\Field\CSS;
11
12 use Kirki\Module\CSS\Output;
13
14 /**
15 * Output overrides.
16 */
17 class Margin extends Output {
18
19 /**
20 * The field type.
21 *
22 * @since 1.0
23 * @access public
24 * @var string
25 */
26 protected $type = 'kirki-margin';
27
28 /**
29 * Process a single item from the `output` array.
30 *
31 * @since 1.0
32 * @access protected
33 *
34 * @param array $output The `output` item.
35 * @param array|string $value The field's value.
36 */
37 protected function process_output( $output, $value ) {
38
39 $property = str_ireplace( 'kirki-', '', $this->type );
40 $unit = isset( $this->field['choices'] ) && isset( $this->field['choices']['unit'] ) ? $this->field['choices']['unit'] : 'px';
41
42 $output = wp_parse_args(
43 $output,
44 array(
45 'media_query' => 'global',
46 'element' => '',
47 )
48 );
49
50 // Stop if the value is not an array.
51 if ( ! is_array( $value ) ) {
52 return;
53 }
54
55 foreach ( $value as $position => $value ) {
56 if ( '' !== $value ) {
57 $value = is_numeric( $value ) ? $value . $unit : $value;
58 $css_property = $property . '-' . $position;
59
60 $this->styles[ $output['media_query'] ][ $output['element'] ][ $css_property ] = $value;
61 }
62 }
63
64 if ( 'kirki_demo_responsive_margin[desktop]' === $this->field['settings'] ) {
65 // error_log( print_r( get_theme_mod( 'kirki_demo_responsive_margin[desktop]' ), true ) );
66 // error_log( print_r( $this->styles, true ) );
67 // error_log( print_r( $value, true ) );
68 }
69
70 }
71
72 }
73