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 / fields / dimensions / src / CSS / Dimensions.php
kirki / customizer / packages / fields / dimensions / src / CSS Last commit date
Dimensions.php 5 months ago
Dimensions.php
61 lines
1 <?php
2 /**
3 * Handles CSS output for dimensions fields.
4 *
5 * @package Kirki
6 * @subpackage Controls
7 * @copyright Copyright (c) 2023, Themeum
8 * @license https://opensource.org/licenses/MIT
9 * @since 2.2.0
10 */
11
12 namespace Kirki\Field\CSS;
13
14 use Kirki\Module\CSS\Output;
15
16 /**
17 * Output overrides.
18 */
19 class Dimensions extends Output {
20
21 /**
22 * Processes a single item from the `output` array.
23 *
24 * @access protected
25 * @param array $output The `output` item.
26 * @param array $value The field's value.
27 */
28 protected function process_output( $output, $value ) {
29 $output = wp_parse_args(
30 $output,
31 [
32 'element' => '',
33 'property' => '',
34 'media_query' => 'global',
35 'prefix' => '',
36 'suffix' => '',
37 ]
38 );
39
40 if ( ! is_array( $value ) ) {
41 return;
42 }
43
44 foreach ( array_keys( $value ) as $key ) {
45
46 $property = ( empty( $output['property'] ) ) ? $key : $output['property'] . '-' . $key;
47 if ( isset( $output['choice'] ) && $output['property'] ) {
48 if ( $key === $output['choice'] ) {
49 $property = $output['property'];
50 } else {
51 continue;
52 }
53 }
54 if ( false !== strpos( $output['property'], '%%' ) ) {
55 $property = str_replace( '%%', $key, $output['property'] );
56 }
57 $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix'];
58 }
59 }
60 }
61