field,
array(
'lg_desktop_icon' => '',
'desktop_icon' => '',
'tablet_icon' => '',
'mobile_landscape_icon' => '',
'mobile_icon' => '',
'all_icon' => '',
'lg_desktop_placeholder' => esc_html__( 'Large Desktop', 'smart-post-show' ),
'desktop_placeholder' => esc_html__( 'Desktop', 'smart-post-show' ),
'tablet_placeholder' => esc_html__( 'Tablet', 'smart-post-show' ),
'mobile_landscape_placeholder' => esc_html__( 'Mobile Landscape', 'smart-post-show' ),
'mobile_placeholder' => esc_html__( 'Mobile', 'smart-post-show' ),
'all_placeholder' => esc_html__( 'all', 'smart-post-show' ),
'lg_desktop' => true,
'desktop' => true,
'tablet' => true,
'mobile_landscape' => true,
'mobile' => true,
'min' => '0',
'unit' => false,
'all' => false,
'units' => array( 'px', '%', 'em' ),
)
);
$default_values = array(
'lg_desktop' => '5',
'desktop' => '4',
'tablet' => '3',
'mobile_landscape' => '2',
'mobile' => '1',
'min' => '',
'all' => '',
'unit' => 'px',
);
// $value = wp_parse_args( $this->value, $default_values );
$value = wp_parse_args( $this->value, $default_values );
$unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
$is_unit = ( ! empty( $unit ) ) ? ' spf--is-unit' : '';
echo wp_kses_post( $this->field_before() );
echo '
';
echo wp_kses_post( $this->field_after() );
}
/**
* The output function.
*
* @return mixed
*/
public function output() {
$output = '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding';
$mode = ( 'relative' === $mode || 'absolute' === $mode || 'none' === $mode ) ? '' : $mode;
$mode = ( ! empty( $mode ) ) ? $mode . '-' : '';
if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && '' !== $this->value['all'] ) {
$output = $element . '{';
$output .= $mode . 'lg_desktop:' . $this->value['all'] . $unit . $important . ';';
$output .= $mode . 'desktop:' . $this->value['all'] . $unit . $important . ';';
$output .= $mode . 'tablet:' . $this->value['all'] . $unit . $important . ';';
$output .= $mode . 'mobile_landscape:' . $this->value['all'] . $unit . $important . ';';
$output .= $mode . 'mobile:' . $this->value['all'] . $unit . $important . ';';
$output .= '}';
} else {
$lg_desktop = ( isset( $this->value['lg_desktop'] ) && '' !== $this->value['lg_desktop'] ) ? $mode . 'lg_desktop:' . $this->value['lg_desktop'] . $unit . $important . ';' : '';
$desktop = ( isset( $this->value['desktop'] ) && '' !== $this->value['desktop'] ) ? $mode . 'desktop:' . $this->value['desktop'] . $unit . $important . ';' : '';
$tablet = ( isset( $this->value['tablet'] ) && '' !== $this->value['tablet'] ) ? $mode . 'tablet:' . $this->value['tablet'] . $unit . $important . ';' : '';
$mobile_landscape = ( isset( $this->value['mobile_landscape'] ) && '' !== $this->value['mobile_landscape'] ) ? $mode . 'mobile_landscape:' . $this->value['mobile_landscape'] . $unit . $important . ';' : '';
$mobile = ( isset( $this->value['mobile'] ) && '' !== $this->value['mobile'] ) ? $mode . 'mobile:' . $this->value['mobile'] . $unit . $important . ';' : '';
if ( '' !== $lg_desktop || '' !== $desktop || '' !== $tablet || '' !== $mobile_landscape || '' !== $mobile ) {
$output = $element . '{' . $lg_desktop . $desktop . $tablet . $mobile_landscape . $mobile . '}';
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}