field, array( 'lg_desktop_icon' => '', 'desktop_icon' => '', 'tablet_icon' => '', 'mobile_landscape_icon' => '', 'mobile_icon' => '', 'all_icon' => '', 'lg_desktop_placeholder' => esc_html__( 'Large Desktop', 'post-carousel' ), 'desktop_placeholder' => esc_html__( 'Desktop', 'post-carousel' ), 'tablet_placeholder' => esc_html__( 'Tablet', 'post-carousel' ), 'mobile_landscape_placeholder' => esc_html__( 'Mobile Landscape', 'post-carousel' ), 'mobile_placeholder' => esc_html__( 'Mobile', 'post-carousel' ), 'all_placeholder' => esc_html__( 'all', 'post-carousel' ), 'lg_desktop' => true, 'desktop' => true, 'tablet' => true, 'mobile_landscape' => true, 'mobile' => true, 'min' => '1', 'unit' => false, 'decimal' => 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 '
'; $min = ( isset( $args['min'] ) ) ? ' min="' . $args['min'] . '"' : ''; $decimal = ( isset( $args['decimal'] ) && $args['decimal'] ) ? ' step="any"' : ''; if ( ! empty( $args['all'] ) ) { $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : ''; echo '
'; echo ( ! empty( $args['all_icon'] ) ) ? '' . wp_kses_post( $args['all_icon'] ) . '' : ''; echo ''; echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '' . esc_html( $args['units'][0] ) . '' : ''; echo '
'; } else { $properties = array(); foreach ( array( 'lg_desktop', 'desktop', 'tablet', 'mobile_landscape', 'mobile' ) as $prop ) { if ( ! empty( $args[ $prop ] ) ) { $properties[] = $prop; } } $properties = ( array( 'tablet', 'mobile' ) === $properties ) ? array_reverse( $properties ) : $properties; foreach ( $properties as $property ) { $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; echo '
'; echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '' . wp_kses_post( $args[ $property . '_icon' ] ) . '' : ''; echo ''; echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '' . esc_html( $args['units'][0] ) . '' : ''; echo '
'; } } if ( ! empty( $args['unit'] ) && count( $args['units'] ) > 1 ) { echo '
'; echo ''; echo '
'; } echo '
'; echo wp_kses_post( $this->field_after() ); } } }