This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Astra_Update_Footer_Builder_Design::sanitize_background( array $background )

Sanitize background settings.


Description


Parameters

$background

(array) (Required) Background data to sanitize.


Return

(array) Sanitized background data.


Source

File: inc/abilities/customizer/footer/class-astra-update-footer-builder-design.php

	private function sanitize_background( $background ) {
		$sanitized = array();
		$devices   = array( 'desktop', 'tablet', 'mobile' );

		foreach ( $devices as $device ) {
			if ( isset( $background[ $device ] ) && is_array( $background[ $device ] ) ) {
				$sanitized[ $device ] = array();
				$allowed_keys         = array(
					'background-color',
					'background-image',
					'background-repeat',
					'background-position',
					'background-size',
					'background-attachment',
					'background-media',
					'background-type',
					'overlay-type',
					'overlay-color',
					'overlay-gradient',
				);

				foreach ( $allowed_keys as $key ) {
					if ( isset( $background[ $device ][ $key ] ) ) {
						$sanitized[ $device ][ $key ] = sanitize_text_field( $background[ $device ][ $key ] );
					}
				}
			}
		}

		return $sanitized;
	}


User Contributed Notes

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