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::sanitize_footer_layout( array $layout, string $type = 'desktop' )

Sanitize footer layout data.


Description


Parameters

$layout

(array) (Required) Layout data to sanitize.

$type

(string) (Optional) Device type (desktop or mobile).

Default value: 'desktop'


Return

(array) Sanitized layout data.


Source

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

	private function sanitize_footer_layout( $layout, $type = 'desktop' ) {
		$sanitized = array();
		$sections  = array( 'above', 'primary', 'below' );

		$desktop_columns = array(
			'above'   => array( 'above_1', 'above_2', 'above_3', 'above_4', 'above_5', 'above_6' ),
			'primary' => array( 'primary_1', 'primary_2', 'primary_3', 'primary_4', 'primary_5', 'primary_6' ),
			'below'   => array( 'below_1', 'below_2', 'below_3', 'below_4', 'below_5', 'below_6' ),
		);

		$mobile_columns = array(
			'above'   => array( 'above_1', 'above_2' ),
			'primary' => array( 'primary_1', 'primary_2' ),
			'below'   => array( 'below_1', 'below_2' ),
		);

		$columns = 'desktop' === $type ? $desktop_columns : $mobile_columns;

		foreach ( $sections as $section ) {
			if ( isset( $layout[ $section ] ) && is_array( $layout[ $section ] ) ) {
				$section_columns = array();
				foreach ( $columns[ $section ] as $column ) {
					if ( isset( $layout[ $section ][ $column ] ) && is_array( $layout[ $section ][ $column ] ) ) {
						// Normalize component IDs (e.g., widget -> widget-1).
						$normalized = array_map( array( $this, 'normalize_component_id' ), $layout[ $section ][ $column ] );

						$section_columns[ $column ] = $normalized;
					}
				}

				// Only include section if it has columns.
				if ( ! empty( $section_columns ) ) {
					$sanitized[ $section ] = $section_columns;
				}
			}
		}

		return $sanitized;
	}


User Contributed Notes

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