class-kirki-output-field-spacing.php (1217B)
1 <?php 2 /** 3 * Handles CSS output for spacing fields. 4 * 5 * @package Kirki 6 * @subpackage Controls 7 * @copyright Copyright (c) 2016, Aristeides Stathopoulos 8 * @license http://opensource.org/licenses/https://opensource.org/licenses/MIT 9 * @since 2.2.0 10 */ 11 12 if ( ! class_exists( 'Kirki_Output_Field_Spacing' ) ) { 13 14 /** 15 * Output overrides. 16 */ 17 class Kirki_Output_Field_Spacing extends Kirki_Output { 18 19 /** 20 * Processes a single item from the `output` array. 21 * 22 * @access protected 23 * @param array $output The `output` item. 24 * @param array $value The field's value. 25 */ 26 protected function process_output( $output, $value ) { 27 28 foreach ( $value as $key => $sub_value ) { 29 30 if ( ! isset( $output['property'] ) || empty( $output['property'] ) ) { 31 $property = $key; 32 } elseif ( false !== strpos( $output['property'], '%%' ) ) { 33 $property = str_replace( '%%', $key, $output['property'] ); 34 } else { 35 $property = $output['property'] . '-' . $key; 36 } 37 $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; 38 $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value; 39 40 } 41 } 42 } 43 }