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

Header Footer builder – Migration of Footer.


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_builder_migration( $theme_options, $used_elements, $widget_options ) {
	/**
	 * Footer
	 */
	$footer_layout = ( isset( $theme_options['footer-sml-layout'] ) ) ? $theme_options['footer-sml-layout'] : '';

	if ( isset( $theme_options['footer-layout-width'] ) ) {
		$theme_options['hb-footer-layout-width'] = $theme_options['footer-layout-width'];
	}
	if ( isset( $theme_options['footer-sml-divider'] ) ) {
		$theme_options['hbb-footer-separator'] = $theme_options['footer-sml-divider'];
	}
	if ( isset( $theme_options['footer-sml-divider-color'] ) ) {
		$theme_options['hbb-footer-top-border-color'] = $theme_options['footer-sml-divider-color'];
	}
	if ( isset( $theme_options['footer-bg-obj'] ) ) {
		$theme_options['hbb-footer-bg-obj-responsive'] = array(
			'desktop' => $theme_options['footer-bg-obj'],
			'tablet'  => '',
			'mobile'  => '',
		);
	}
	if ( isset( $theme_options['footer-sml-spacing'] ) ) {
		$theme_options['section-below-footer-builder-padding'] = $theme_options['footer-sml-spacing'];
	}

	// Footer Section 1.
	$footer_section_1   = ( isset( $theme_options['footer-sml-section-1'] ) ) ? $theme_options['footer-sml-section-1'] : '';
	$new_section_1_item = '';
	$used_elements[]    = $new_section_1_item;

	$footer_section_2   = ( isset( $theme_options['footer-sml-section-2'] ) ) ? $theme_options['footer-sml-section-2'] : '';
	$new_section_2_item = '';
	$used_elements[]    = $new_section_2_item;

	switch ( $footer_section_1 ) {
		case 'custom':
			$new_section_1_item                          = 'copyright';
			$theme_options['footer-copyright-alignment'] = array(
				'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
				'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
				'mobile'  => 'center',
			);
			break;

		case 'widget':
			$new_section_1_item                         = 'widget-1';
			$theme_options['footer-widget-alignment-1'] = array(
				'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
				'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
				'mobile'  => 'center',
			);
			if ( isset( $theme_options['footer-color'] ) ) {
				$theme_options['footer-widget-1-color'] = array(
					'desktop' => $theme_options['footer-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-color'] ) ) {
				$theme_options['footer-widget-1-link-color'] = array(
					'desktop' => $theme_options['footer-link-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-h-color'] ) ) {
				$theme_options['footer-widget-1-link-h-color'] = array(
					'desktop' => $theme_options['footer-link-h-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['font-size-footer-content'] ) ) {
				$theme_options['footer-widget-1-content-font-size'] = $theme_options['font-size-footer-content'];
			}

			if ( isset( $theme_options['font-weight-footer-content'] ) ) {
				$theme_options['footer-widget-1-content-font-weight'] = $theme_options['font-weight-footer-content'];
			}

			if ( isset( $theme_options['line-height-footer-content'] ) ) {
				$theme_options['footer-widget-1-content-line-height'] = $theme_options['line-height-footer-content'];
			}

			if ( isset( $theme_options['font-family-footer-content'] ) ) {
				$theme_options['footer-widget-1-content-font-family'] = $theme_options['font-family-footer-content'];
			}

			if ( isset( $theme_options['text-transform-footer-content'] ) ) {
				$theme_options['footer-widget-1-content-text-transform'] = $theme_options['text-transform-footer-content'];
			}


			break;

		case 'menu':
			$theme_options['footer-menu-alignment'] = array(
				'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-start',
				'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-start',
				'mobile'  => 'center',
			);
			$new_section_1_item                     = 'menu';
			break;
	}

	// Footer Section 2.
	switch ( $footer_section_2 ) {
		case 'custom':
			$new_section_2_item = ( 'copyright' !== $new_section_1_item ) ? 'copyright' : 'html-1';
			if ( 'copyright' !== $new_section_1_item ) {
				$theme_options['footer-copyright-alignment'] = array(
					'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
					'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
					'mobile'  => 'center',
				);
				if ( isset( $theme_options['footer-sml-section-2-credit'] ) ) {
					$theme_options['footer-copyright-editor'] = $theme_options['footer-sml-section-2-credit'];
				}
			} else {
				$theme_options['footer-html-1-alignment'] = array(
					'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
					'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
					'mobile'  => 'center',
				);
				if ( isset( $theme_options['footer-sml-section-2-credit'] ) ) {
					$theme_options['footer-html-1'] = $theme_options['footer-sml-section-2-credit'];
				}
			}

			break;

		case 'widget':
			$new_section_2_item                         = 'widget-2';
			$theme_options['footer-widget-alignment-2'] = array(
				'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
				'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
				'mobile'  => 'center',
			);
			if ( isset( $theme_options['footer-color'] ) ) {
				$theme_options['footer-widget-2-color'] = array(
					'desktop' => $theme_options['footer-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-color'] ) ) {
				$theme_options['footer-widget-2-link-color'] = array(
					'desktop' => $theme_options['footer-link-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-h-color'] ) ) {
				$theme_options['footer-widget-2-link-h-color'] = array(
					'desktop' => $theme_options['footer-link-h-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['font-size-footer-content'] ) ) {
				$theme_options['footer-widget-2-content-font-size'] = $theme_options['font-size-footer-content'];
			}

			if ( isset( $theme_options['font-weight-footer-content'] ) ) {
				$theme_options['footer-widget-2-content-font-weight'] = $theme_options['font-weight-footer-content'];
			}

			if ( isset( $theme_options['line-height-footer-content'] ) ) {
				$theme_options['footer-widget-2-content-line-height'] = $theme_options['line-height-footer-content'];
			}

			if ( isset( $theme_options['font-family-footer-content'] ) ) {
				$theme_options['footer-widget-2-content-font-family'] = $theme_options['font-family-footer-content'];
			}

			if ( isset( $theme_options['text-transform-footer-content'] ) ) {
				$theme_options['footer-widget-2-content-text-transform'] = $theme_options['text-transform-footer-content'];
			}


			break;

		case 'menu':
			$new_section_2_item                     = 'menu';
			$theme_options['footer-menu-alignment'] = array(
				'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-end',
				'tablet'  => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-end',
				'mobile'  => 'center',
			);
			break;
	}

	if ( 'custom' === $footer_section_1 || 'custom' === $footer_section_2 ) {

		// Footer Content Color migrated to Copyright.
		if ( isset( $theme_options['footer-sml-section-1-credit'] ) ) {
			$theme_options['footer-copyright-editor'] = $theme_options['footer-sml-section-1-credit'];
		}
		if ( isset( $theme_options['footer-color'] ) ) {
			$theme_options['footer-copyright-color'] = $theme_options['footer-color'];
		}
		if ( isset( $theme_options['footer-link-color'] ) ) {
			$theme_options['footer-copyright-link-color'] = $theme_options['footer-link-color'];
		}
		if ( isset( $theme_options['footer-link-h-color'] ) ) {
			$theme_options['footer-copyright-link-h-color'] = $theme_options['footer-link-h-color'];
		}

		if ( isset( $theme_options['font-size-footer-content'] ) ) {
			$theme_options['font-size-section-footer-copyright'] = $theme_options['font-size-footer-content'];
		}

		if ( isset( $theme_options['font-weight-footer-content'] ) ) {
			$theme_options['font-weight-section-footer-copyright'] = $theme_options['font-weight-footer-content'];
		}

		if ( isset( $theme_options['line-height-footer-content'] ) ) {
			$theme_options['line-height-section-footer-copyright'] = $theme_options['line-height-footer-content'];
		}

		if ( isset( $theme_options['font-family-footer-content'] ) ) {
			$theme_options['font-family-section-footer-copyright'] = $theme_options['font-family-footer-content'];
		}

		if ( isset( $theme_options['text-transform-footer-content'] ) ) {
			$theme_options['text-transform-section-footer-copyright'] = $theme_options['text-transform-footer-content'];
		}

		if ( 'html-1' === $new_section_2_item ) {
			// Footer Content Color migrated to HTML 1.
			if ( isset( $theme_options['footer-color'] ) ) {
				$theme_options['footer-html-1-color'] = array(
					'desktop' => $theme_options['footer-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-color'] ) ) {
				$theme_options['footer-html-1-link-color'] = array(
					'desktop' => $theme_options['footer-link-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}
			if ( isset( $theme_options['footer-link-h-color'] ) ) {
				$theme_options['footer-html-1-link-h-color'] = array(
					'desktop' => $theme_options['footer-link-h-color'],
					'tablet'  => '',
					'mobile'  => '',
				);
			}

			if ( isset( $theme_options['font-size-footer-content'] ) ) {
				$theme_options['font-size-section-fb-html-1'] = $theme_options['font-size-footer-content'];
			}

			if ( isset( $theme_options['font-weight-footer-content'] ) ) {
				$theme_options['font-weight-section-fb-html-1'] = $theme_options['font-weight-footer-content'];
			}

			if ( isset( $theme_options['line-height-footer-content'] ) ) {
				$theme_options['line-height-section-fb-html-1'] = $theme_options['line-height-footer-content'];
			}

			if ( isset( $theme_options['font-family-footer-content'] ) ) {
				$theme_options['font-family-section-fb-html-1'] = $theme_options['font-family-footer-content'];
			}

			if ( isset( $theme_options['text-transform-footer-content'] ) ) {
				$theme_options['text-transform-section-fb-html-1'] = $theme_options['text-transform-footer-content'];
			}
		}
	}

	if ( 'menu' === $footer_section_1 || 'menu' === $footer_section_2 ) {
		if ( isset( $theme_options['footer-link-color'] ) ) {
			$theme_options['footer-menu-color-responsive'] = array(
				'desktop' => $theme_options['footer-link-color'],
				'tablet'  => '',
				'mobile'  => '',
			);
		}
		if ( isset( $theme_options['footer-link-h-color'] ) ) {
			$theme_options['footer-menu-h-color-responsive'] = array(
				'desktop' => $theme_options['footer-link-h-color'],
				'tablet'  => '',
				'mobile'  => '',
			);
		}

		$theme_options['footer-menu-layout'] = array(
			'desktop' => 'horizontal',
			'tablet'  => 'horizontal',
			'mobile'  => 'horizontal',
		);

		if ( isset( $theme_options['font-size-footer-content'] ) ) {
			$theme_options['footer-menu-font-size'] = $theme_options['font-size-footer-content'];
		}

		if ( isset( $theme_options['font-weight-footer-content'] ) ) {
			$theme_options['footer-menu-font-weight'] = $theme_options['font-weight-footer-content'];
		}

		if ( isset( $theme_options['line-height-footer-content'] ) ) {
			$theme_options['footer-menu-line-height'] = $theme_options['line-height-footer-content'];
		}

		if ( isset( $theme_options['font-family-footer-content'] ) ) {
			$theme_options['footer-menu-font-family'] = $theme_options['font-family-footer-content'];
		}

		if ( isset( $theme_options['text-transform-footer-content'] ) ) {
			$theme_options['footer-menu-text-transform'] = $theme_options['text-transform-footer-content'];
		}

		if ( isset( $theme_options['footer-menu-spacing'] ) ) {
			$theme_options['footer-main-menu-spacing'] = $theme_options['footer-menu-spacing'];
		}
	}

	if ( '' !== $footer_layout ) {

		$theme_options['footer-desktop-items'] = array(
			'above'   =>
				array(
					'above_1' => array(),
					'above_2' => array(),
					'above_3' => array(),
					'above_4' => array(),
					'above_5' => array(),
				),
			'primary' =>
				array(
					'primary_1' => array(),
					'primary_2' => array(),
					'primary_3' => array(),
					'primary_4' => array(),
					'primary_5' => array(),
				),
			'below'   =>
				array(
					'below_1' => array(),
					'below_2' => array(),
					'below_3' => array(),
					'below_4' => array(),
					'below_5' => array(),
				),
		);

		switch ( $footer_layout ) {
			case 'footer-sml-layout-1':
				$theme_options['footer-desktop-items']['below'] = array(
					'below_1' => array( $new_section_1_item, $new_section_2_item ),
					'below_2' => array(),
					'below_3' => array(),
					'below_4' => array(),
					'below_5' => array(),
				);
				$theme_options['hbb-footer-column']             = 1;
				$theme_options['hbb-footer-layout']             = array(
					'desktop' => 'full',
					'tablet'  => 'full',
					'mobile'  => 'full',
				);
				break;

			case 'footer-sml-layout-2':
				$theme_options['footer-desktop-items']['below'] = array(
					'below_1' => array( $new_section_1_item ),
					'below_2' => array( $new_section_2_item ),
					'below_3' => array(),
					'below_4' => array(),
					'below_5' => array(),
				);
				$theme_options['hbb-footer-column']             = 2;
				$theme_options['hbb-footer-layout']             = array(
					'desktop' => '2-equal',
					'tablet'  => '2-equal',
					'mobile'  => 'full',
				);
				break;

			default:
				$theme_options['footer-desktop-items']['below'] = array(
					'below_1' => array( 'copyright' ),
					'below_2' => array(),
					'below_3' => array(),
					'below_4' => array(),
					'below_5' => array(),
				);
		}
	}

	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.