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

Header Footer builder – Migration of Sticky Header.


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_sticky_header_builder_migration( $theme_options, $used_elements, $widget_options ) {

	// Menu.
	$is_menu_in_primary = false;
	$is_menu_in_above   = false;
	$is_menu_in_below   = false;

	if ( isset( $theme_options['header-desktop-items']['primary'] ) ) {
		foreach ( $theme_options['header-desktop-items']['primary'] as $zone ) {
			if ( false !== array_search( 'menu-1', $zone ) ) {
				$is_menu_in_primary = true;
			}
		}
	}

	if ( isset( $theme_options['header-desktop-items']['above'] ) ) {
		foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
			if ( false !== array_search( 'menu-1', $zone ) ) {
				$is_menu_in_above = true;
			}
		}
	}

	if ( isset( $theme_options['header-desktop-items']['below'] ) ) {
		foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
			if ( false !== array_search( 'menu-1', $zone ) ) {
				$is_menu_in_below = true;
			}
		}
	}

	if ( $is_menu_in_primary ) {

		// Menu.
		// Normal.
		if ( isset( $theme_options['sticky-header-menu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-color-responsive'] = $theme_options['sticky-header-menu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-menu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-bg-obj-responsive'] = $theme_options['sticky-header-menu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-h-color-responsive'] = $theme_options['sticky-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-h-bg-color-responsive'] = $theme_options['sticky-header-menu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-a-color-responsive'] = $theme_options['sticky-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-a-bg-color-responsive'] = $theme_options['sticky-header-menu-h-a-bg-color-responsive'];
		}


		// Submenu.

		// Normal.
		if ( isset( $theme_options['sticky-header-submenu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-color-responsive'] = $theme_options['sticky-header-submenu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-submenu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-bg-color-responsive'] = $theme_options['sticky-header-submenu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-h-color-responsive'] = $theme_options['sticky-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-h-bg-color-responsive'] = $theme_options['sticky-header-submenu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-a-color-responsive'] = $theme_options['sticky-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu1-submenu-a-bg-color-responsive'] = $theme_options['sticky-header-submenu-h-a-bg-color-responsive'];
		}


		// Mega menu.

		// Normal.
		if ( isset( $theme_options['sticky-primary-header-megamenu-heading-color'] ) ) {
			$theme_options['sticky-header-menu1-header-megamenu-heading-color'] = $theme_options['sticky-primary-header-megamenu-heading-color'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-primary-header-megamenu-heading-h-color'] ) ) {
			$theme_options['sticky-header-menu1-header-megamenu-heading-h-color'] = $theme_options['sticky-primary-header-megamenu-heading-h-color'];
		}
	}

	if ( $is_menu_in_above ) {

		// Menu.

		// Normal.
		if ( isset( $theme_options['sticky-above-header-menu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-color-responsive'] = $theme_options['sticky-above-header-menu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-menu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-bg-obj-responsive'] = $theme_options['sticky-above-header-menu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-above-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-h-color-responsive'] = $theme_options['sticky-above-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-h-bg-color-responsive'] = $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-above-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-a-color-responsive'] = $theme_options['sticky-above-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-a-bg-color-responsive'] = $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'];
		}


		// Submenu.

		// Normal.
		if ( isset( $theme_options['sticky-above-header-submenu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-color-responsive'] = $theme_options['sticky-above-header-submenu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-submenu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-bg-obj-responsive'] = $theme_options['sticky-above-header-submenu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-above-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-h-color-responsive'] = $theme_options['sticky-above-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-h-bg-color-responsive'] = $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-above-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-a-color-responsive'] = $theme_options['sticky-above-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu3-submenu-a-bg-color-responsive'] = $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'];
		}


		// Mega menu.

		// Normal.
		if ( isset( $theme_options['sticky-above-header-megamenu-heading-color'] ) ) {
			$theme_options['sticky-header-menu3-header-megamenu-heading-color'] = $theme_options['sticky-above-header-megamenu-heading-color'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-above-header-megamenu-heading-h-color'] ) ) {
			$theme_options['sticky-header-menu3-header-megamenu-heading-h-color'] = $theme_options['sticky-above-header-megamenu-heading-h-color'];
		}
	}

	if ( $is_menu_in_below ) {

		// Menu.

		// Normal.
		if ( isset( $theme_options['sticky-below-header-menu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-color-responsive'] = $theme_options['sticky-below-header-menu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-menu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-bg-obj-responsive'] = $theme_options['sticky-below-header-menu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-below-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-h-color-responsive'] = $theme_options['sticky-below-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-h-bg-color-responsive'] = $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-below-header-menu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-a-color-responsive'] = $theme_options['sticky-below-header-menu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-a-bg-color-responsive'] = $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'];
		}


		// Submenu.

		// Normal.
		if ( isset( $theme_options['sticky-below-header-submenu-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-color-responsive'] = $theme_options['sticky-below-header-submenu-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-submenu-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-bg-obj-responsive'] = $theme_options['sticky-below-header-submenu-bg-color-responsive'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-below-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-h-color-responsive'] = $theme_options['sticky-below-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-h-bg-color-responsive'] = $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'];
		}


		// Active.
		if ( isset( $theme_options['sticky-below-header-submenu-h-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-a-color-responsive'] = $theme_options['sticky-below-header-submenu-h-color-responsive'];
		}

		if ( isset( $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'] ) ) {
			$theme_options['sticky-header-menu2-submenu-a-bg-color-responsive'] = $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'];
		}


		// Mega menu.

		// Normal.
		if ( isset( $theme_options['sticky-below-header-megamenu-heading-color'] ) ) {
			$theme_options['sticky-header-menu2-header-megamenu-heading-color'] = $theme_options['sticky-below-header-megamenu-heading-color'];
		}


		// Hover.
		if ( isset( $theme_options['sticky-below-header-megamenu-heading-h-color'] ) ) {
			$theme_options['sticky-header-menu2-header-megamenu-heading-h-color'] = $theme_options['sticky-below-header-megamenu-heading-h-color'];
		}
	}

	// Sticky Site Title.

	// Normal.
	if ( isset( $theme_options['sticky-header-color-site-title-responsive']['desktop'] ) ) {
		$theme_options['sticky-header-builder-site-title-color'] = $theme_options['sticky-header-color-site-title-responsive']['desktop'];
	}


	// Hover.
	if ( isset( $theme_options['sticky-header-color-h-site-title-responsive']['desktop'] ) ) {
		$theme_options['sticky-header-builder-site-title-h-color'] = $theme_options['sticky-header-color-h-site-title-responsive']['desktop'];
	}


	// Sticky Site Tagline.
	if ( isset( $theme_options['sticky-header-color-site-tagline-responsive']['desktop'] ) ) {
		$theme_options['sticky-header-builder-site-tagline-color'] = $theme_options['sticky-header-color-site-tagline-responsive']['desktop'];
	}


	// Sticky Above/Below Header HTML.
	$is_html_in_above = false;
	$is_html_in_below = false;

	foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
		if ( false !== array_search( 'html-3', $zone ) ) {
			$is_html_in_above = true;
		}
	}
	foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
		if ( false !== array_search( 'html-2', $zone ) ) {
			$is_html_in_below = true;
		}
	}

	if ( $is_html_in_above ) {

		if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-html-3color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
		}
	}
	if ( $is_html_in_below ) {

		if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-html-2color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
		}
	}

	// Sticky Above/Below Header Search.
	$is_search_in_above = false;
	$is_search_in_below = false;

	foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
		if ( false !== array_search( 'search', $zone ) ) {
			$is_search_in_above = true;
		}
	}
	foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
		if ( false !== array_search( 'search', $zone ) ) {
			$is_search_in_below = true;
		}
	}

	if ( $is_search_in_above ) {

		if ( isset( $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-search-icon-color'] = $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'];
		}
	}
	if ( $is_search_in_below ) {

		if ( isset( $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-search-icon-color'] = $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'];
		}
	}

	// Sticky Above/Below Header Widget.
	$is_widget_in_above = false;
	$is_widget_in_below = false;

	foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
		if ( false !== array_search( 'widget-3', $zone ) ) {
			$is_widget_in_above = true;
		}
	}
	foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
		if ( false !== array_search( 'widget-2', $zone ) ) {
			$is_widget_in_below = true;
		}
	}

	if ( $is_widget_in_above ) {

		if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-3-title-color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-3-color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-3-link-color'] = $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-above-header-content-section-link-h-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-3-link-h-color'] = $theme_options['sticky-above-header-content-section-link-h-color-responsive']['desktop'];
		}
	}
	if ( $is_widget_in_below ) {

		if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-2-title-color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-2-color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-2-link-color'] = $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'];
		}

		if ( isset( $theme_options['sticky-below-header-content-section-link-h-color-responsive']['desktop'] ) ) {
			$theme_options['sticky-header-widget-2-link-h-color'] = $theme_options['sticky-below-header-content-section-link-h-color-responsive']['desktop'];
		}
	}

	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.