Astra_Customizer_Sanitizes::sanitize_responsive_spacing( number $val )

Sanitize responsive Spacing


Description


Parameters

$val

(number) (Required) Customizer setting input number.


Return

(number) Return number.


Source

File: inc/customizer/class-astra-customizer-sanitizes.php

		public static function sanitize_responsive_spacing( $val ) {

			$spacing = array(
				'desktop'      => array(
					'top'    => '',
					'right'  => '',
					'bottom' => '',
					'left'   => '',
				),
				'tablet'       => array(
					'top'    => '',
					'right'  => '',
					'bottom' => '',
					'left'   => '',
				),
				'mobile'       => array(
					'top'    => '',
					'right'  => '',
					'bottom' => '',
					'left'   => '',
				),
				'desktop-unit' => 'px',
				'tablet-unit'  => 'px',
				'mobile-unit'  => 'px',
			);

			if ( isset( $val['desktop'] ) ) {
				$spacing['desktop'] = array_map( 'self::check_numberic_values', $val['desktop'] );

				$spacing['tablet'] = array_map( 'self::check_numberic_values', $val['tablet'] );

				$spacing['mobile'] = array_map( 'self::check_numberic_values', $val['mobile'] );

				if ( isset( $val['desktop-unit'] ) ) {
					$spacing['desktop-unit'] = $val['desktop-unit'];
				}

				if ( isset( $val['tablet-unit'] ) ) {
					$spacing['tablet-unit'] = $val['tablet-unit'];
				}

				if ( isset( $val['mobile-unit'] ) ) {
					$spacing['mobile-unit'] = $val['mobile-unit'];
				}

				return $spacing;

			} else {
				foreach ( $val as $key => $value ) {
					$val[ $key ] = is_numeric( $val[ $key ] ) ? $val[ $key ] : '';
				}
				return $val;
			}

		}

Changelog

Changelog
Version Description
1.2.1 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.