astra_footer_widgets_migration( array $theme_options, array $used_elements, array $widget_options )

Header Footer builder – Migration of Footer Widgets.


Description


Parameters

$theme_options

(array) (Required) Theme options.

$used_elements

(array) (Required) Used Elements array.

$widget_options

(array) (Required) Widget options.


Return

(array)


Source

File: inc/theme-update/astra-builder-migration-updater.php

function astra_footer_widgets_migration( $theme_options, $used_elements, $widget_options ) {

	$footer_widget_layouts = ( isset( $theme_options['footer-adv'] ) ) ? $theme_options['footer-adv'] : '';

	if ( '' !== $footer_widget_layouts ) {

		$column = 2;
		$layout = array(
			'desktop' => '2-equal',
			'tablet'  => '2-equal',
			'mobile'  => 'full',
		);
		$items  = array(
			'above_1' => array(),
			'above_2' => array(),
			'above_3' => array(),
			'above_4' => array(),
			'above_5' => array(),
		);

		switch ( $footer_widget_layouts ) {
			case 'layout-1':
				$column = '1';
				$layout = array(
					'desktop' => 'full',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array(),
					'above_3' => array(),
					'above_4' => array(),
					'above_5' => array(),
				);
				break;

			case 'layout-2':
				$column = '2';
				$layout = array(
					'desktop' => '2-equal',
					'tablet'  => '2-equal',
					'mobile'  => '2-equal',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array( 'widget-2' ),
					'above_3' => array(),
					'above_4' => array(),
					'above_5' => array(),
				);
				break;

			case 'layout-3':
				$column = '3';
				$layout = array(
					'desktop' => '3-equal',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array( 'widget-2' ),
					'above_3' => array( 'widget-3' ),
					'above_4' => array(),
					'above_5' => array(),
				);
				break;

			case 'layout-4':
				$column = '4';
				$layout = array(
					'desktop' => '4-equal',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array( 'widget-2' ),
					'above_3' => array( 'widget-3' ),
					'above_4' => array( 'widget-4' ),
					'above_5' => array(),
				);
				break;

			case 'layout-5':
				$column = '5';
				$layout = array(
					'desktop' => '5-equal',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array( 'widget-2' ),
					'above_3' => array( 'widget-3' ),
					'above_4' => array( 'widget-4' ),
					'above_5' => array( 'widget-5' ),
				);
				break;

			case 'layout-6':
			case 'layout-7':
				$column = '3';
				$layout = array(
					'desktop' => '3-lheavy',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				$items  = array(
					'above_1' => array( 'widget-1' ),
					'above_2' => array( 'widget-2' ),
					'above_3' => array( 'widget-3' ),
					'above_4' => array(),
					'above_5' => array(),
				);
				break;
		}

		$theme_options['hba-footer-column'] = $column;
		$theme_options['hba-footer-layout'] = $layout;
		if ( isset( $theme_options['footer-desktop-items'] ) ) {
			$theme_options['footer-desktop-items']['above'] = $items;
		}

		for ( $i = 1; $i <= $column; $i++ ) {

			if ( isset( $theme_options['footer-adv-wgt-title-color'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-title-color' ] = array(
					'desktop' => $theme_options['footer-adv-wgt-title-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['footer-adv-text-color'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-color' ] = array(
					'desktop' => $theme_options['footer-adv-text-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['footer-adv-link-color'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-link-color' ] = array(
					'desktop' => $theme_options['footer-adv-link-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['footer-adv-link-h-color'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-link-h-color' ] = array(
					'desktop' => $theme_options['footer-adv-link-h-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}


			if ( isset( $theme_options['footer-adv-wgt-title-font-size'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-font-size' ] = $theme_options['footer-adv-wgt-title-font-size'];
			}

			if ( isset( $theme_options['footer-adv-wgt-title-font-weight'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-font-weight' ] = $theme_options['footer-adv-wgt-title-font-weight'];
			}

			if ( isset( $theme_options['footer-adv-wgt-title-line-height'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-line-height' ] = $theme_options['footer-adv-wgt-title-line-height'];
			}

			if ( isset( $theme_options['footer-adv-wgt-title-font-family'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-font-family' ] = $theme_options['footer-adv-wgt-title-font-family'];
			}

			if ( isset( $theme_options['footer-adv-wgt-title-text-transform'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-text-transform' ] = $theme_options['footer-adv-wgt-title-text-transform'];
			}


			if ( isset( $theme_options['footer-adv-wgt-content-font-size'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-content-font-size' ] = $theme_options['footer-adv-wgt-content-font-size'];
			}

			if ( isset( $theme_options['footer-adv-wgt-content-font-weight'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-content-font-weight' ] = $theme_options['footer-adv-wgt-content-font-weight'];
			}

			if ( isset( $theme_options['footer-adv-wgt-content-line-height'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-content-line-height' ] = $theme_options['footer-adv-wgt-content-line-height'];
			}

			if ( isset( $theme_options['footer-adv-wgt-content-font-family'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-content-font-family' ] = $theme_options['footer-adv-wgt-content-font-family'];
			}

			if ( isset( $theme_options['footer-adv-wgt-content-text-transform'] ) ) {
				$theme_options[ 'footer-widget-' . $i . '-content-text-transform' ] = $theme_options['footer-adv-wgt-content-text-transform'];
			}

			if ( isset( $widget_options[ 'advanced-footer-widget-' . $i ] ) ) {
				$widget_options[ 'footer-widget-' . $i ] = $widget_options[ 'advanced-footer-widget-' . $i ];
			}
		}
	}

	if ( isset( $theme_options['footer-adv-border-width'] ) ) {
		$theme_options['hba-footer-separator'] = $theme_options['footer-adv-border-width'];
	}

	if ( isset( $theme_options['footer-adv-border-color'] ) ) {
		$theme_options['hba-footer-top-border-color'] = $theme_options['footer-adv-border-color'];
	}

	if ( isset( $theme_options['footer-adv-bg-obj'] ) ) {
		$theme_options['hba-footer-bg-obj-responsive'] = array(
			'desktop' => $theme_options['footer-adv-bg-obj'],
			'tablet'  => '',
			'mobile'  => '',
		);
	}

	if ( isset( $theme_options['footer-adv-area-padding'] ) ) {
		$theme_options['section-above-footer-builder-padding'] = $theme_options['footer-adv-area-padding'];
	}

	return array(
		'theme_options'  => $theme_options,
		'used_elements'  => $used_elements,
		'widget_options' => $widget_options,
	);
}

Changelog

Changelog
Version Description
3.0.0 Introduced.


User Contributed Notes

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