astra_primary_header_builder_migration( array $theme_options, array $used_elements, array $widget_options )
Header Footer builder – Migration of Primary 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_primary_header_builder_migration( $theme_options, $used_elements, $widget_options ) { /** * Primary Header. */ // Header : Primary Header - Layout. $primary_header_layout = ( isset( $theme_options['header-layouts'] ) ) ? $theme_options['header-layouts'] : ''; // Header : Primary Header - Last Menu Item. $last_menu_item = ( isset( $theme_options['header-main-rt-section'] ) ) ? $theme_options['header-main-rt-section'] : ''; $last_menu_item_mobile_flag = ( isset( $theme_options['hide-custom-menu-mobile'] ) ) ? $theme_options['hide-custom-menu-mobile'] : ''; $last_menu_item_mobile_outside = ( isset( $theme_options['header-display-outside-menu'] ) ) ? $theme_options['header-display-outside-menu'] : ''; $new_menu_item = ''; $theme_options['mobile-header-type'] = 'dropdown'; if ( isset( $theme_options['mobile-menu-style'] ) ) { switch ( $theme_options['mobile-menu-style'] ) { case 'flyout': $theme_options['mobile-header-type'] = 'off-canvas'; if ( isset( $theme_options['flyout-mobile-menu-alignment'] ) ) { $theme_options['off-canvas-slide'] = $theme_options['flyout-mobile-menu-alignment']; } break; case 'fullscreen': $theme_options['mobile-header-type'] = 'full-width'; break; case 'default': default: $theme_options['mobile-header-type'] = 'dropdown'; break; } } switch ( $last_menu_item ) { case 'search': $new_menu_item = 'search'; if ( isset( $theme_options['header-main-rt-section-search-box-type'] ) ) { $theme_options['header-search-box-type'] = $theme_options['header-main-rt-section-search-box-type']; } break; case 'button': $new_menu_item = 'button-1'; if ( isset( $theme_options['header-main-rt-section-button-text'] ) ) { $theme_options['header-button1-text'] = $theme_options['header-main-rt-section-button-text']; } if ( isset( $theme_options['header-main-rt-section-button-link-option'] ) ) { $theme_options['header-button1-link-option'] = $theme_options['header-main-rt-section-button-link-option']; } if ( isset( $theme_options['header-main-rt-section-button-text-color'] ) ) { $theme_options['header-button1-text-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-text-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-back-color'] ) ) { $theme_options['header-button1-back-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-back-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-text-h-color'] ) ) { $theme_options['header-button1-text-h-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-text-h-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-back-h-color'] ) ) { $theme_options['header-button1-back-h-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-back-h-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-border-size'] ) ) { $theme_options['header-button1-border-size'] = $theme_options['header-main-rt-section-button-border-size']; } if ( isset( $theme_options['header-main-rt-section-button-border-color'] ) ) { $theme_options['header-button1-border-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-border-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-border-h-color'] ) ) { $theme_options['header-button1-border-h-color'] = array( 'desktop' => $theme_options['header-main-rt-section-button-border-h-color'], 'tablet' => '', 'mobile' => '', ); } if ( isset( $theme_options['header-main-rt-section-button-border-radius'] ) ) { $theme_options['header-button1-border-radius'] = $theme_options['header-main-rt-section-button-border-radius']; } if ( isset( $theme_options['primary-header-button-font-family'] ) ) { $theme_options['header-button1-font-family'] = $theme_options['primary-header-button-font-family']; } if ( isset( $theme_options['primary-header-button-font-size'] ) ) { $theme_options['header-button1-font-size'] = $theme_options['primary-header-button-font-size']; } if ( isset( $theme_options['primary-header-button-font-weight'] ) ) { $theme_options['header-button1-font-weight'] = $theme_options['primary-header-button-font-weight']; } if ( isset( $theme_options['primary-header-button-text-transform'] ) ) { $theme_options['header-button1-text-transform'] = $theme_options['primary-header-button-text-transform']; } if ( isset( $theme_options['primary-header-button-line-height'] ) ) { $theme_options['header-button1-line-height'] = $theme_options['primary-header-button-line-height']; } if ( isset( $theme_options['primary-header-button-letter-spacing'] ) ) { $theme_options['header-button1-letter-spacing'] = $theme_options['primary-header-button-letter-spacing']; } if ( isset( $theme_options['header-main-rt-section-button-padding'] ) ) { $theme_options['section-hb-button-1-padding'] = $theme_options['header-main-rt-section-button-padding']; } // Sticky Header Button options. // Text Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-text-color'] ) ) { $theme_options['sticky-header-button1-text-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-text-color'], 'tablet' => '', 'mobile' => '', ); } // BG Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-back-color'] ) ) { $theme_options['sticky-header-button1-back-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-back-color'], 'tablet' => '', 'mobile' => '', ); } // Text Hover Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-text-h-color'] ) ) { $theme_options['sticky-header-button1-text-h-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-text-h-color'], 'tablet' => '', 'mobile' => '', ); } // BG Hover Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-back-h-color'] ) ) { $theme_options['sticky-header-button1-back-h-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-back-h-color'], 'tablet' => '', 'mobile' => '', ); } // Border Width. if ( isset( $theme_options['header-main-rt-sticky-section-button-border-size'] ) ) { $theme_options['sticky-header-button1-border-size'] = $theme_options['header-main-rt-sticky-section-button-border-size']; } // Border Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-border-color'] ) ) { $theme_options['sticky-header-button1-border-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-border-color'], 'tablet' => '', 'mobile' => '', ); } // Border Hover Color. if ( isset( $theme_options['header-main-rt-sticky-section-button-border-h-color'] ) ) { $theme_options['sticky-header-button1-border-h-color'] = array( 'desktop' => $theme_options['header-main-rt-sticky-section-button-border-h-color'], 'tablet' => '', 'mobile' => '', ); } // Border Radius. if ( isset( $theme_options['header-main-rt-sticky-section-button-border-radius'] ) ) { $theme_options['sticky-header-button1-border-radius'] = $theme_options['header-main-rt-sticky-section-button-border-radius']; } // Padding. if ( isset( $theme_options['header-main-rt-sticky-section-button-padding'] ) ) { $theme_options['sticky-header-button1-padding'] = $theme_options['header-main-rt-sticky-section-button-padding']; } break; case 'text-html': $new_menu_item = 'html-1'; if ( isset( $theme_options['header-main-rt-section-html'] ) ) { $theme_options['header-html-1'] = $theme_options['header-main-rt-section-html']; } break; case 'widget': $new_menu_item = 'widget-1'; if ( isset( $widget_options['header-widget'] ) ) { $widget_options['header-widget-1'] = $widget_options['header-widget']; } break; case 'woocommerce': $new_menu_item = 'woo-cart'; if ( ! empty( $theme_options['woo-header-cart-icon-color'] ) ) { $theme_options['header-woo-cart-icon-color'] = $theme_options['woo-header-cart-icon-color']; } break; case 'edd': $new_menu_item = 'edd-cart'; break; } $used_elements[] = $new_menu_item; $new_menu_item_mobile = ( ! $last_menu_item_mobile_flag ) ? $new_menu_item : ''; $new_menu_item_mobile_outside = ''; if ( ! $last_menu_item_mobile_flag && $last_menu_item_mobile_outside ) { $new_menu_item_mobile_outside = $new_menu_item; $new_menu_item_mobile = ''; } $theme_options['header-desktop-items']['above'] = array( 'above_left' => array(), 'above_left_center' => array(), 'above_center' => array(), 'above_right_center' => array(), 'above_right' => array(), ); $theme_options['header-mobile-items']['above'] = array( 'above_left' => array(), 'above_center' => array(), 'above_right' => array(), ); $theme_options['header-desktop-items']['below'] = array( 'below_left' => array(), 'below_left_center' => array(), 'below_center' => array(), 'below_right_center' => array(), 'below_right' => array(), ); $theme_options['header-mobile-items']['below'] = array( 'below_left' => array(), 'below_center' => array(), 'below_right' => array(), ); /** * Assign the new locations. */ switch ( $primary_header_layout ) { case 'header-main-layout-1': $theme_options['header-desktop-items']['primary'] = array( 'primary_left' => array( 'logo' ), 'primary_left_center' => array(), 'primary_center' => array(), 'primary_right_center' => array(), 'primary_right' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ), ); break; case 'header-main-layout-2': $theme_options['header-desktop-items']['primary'] = array( 'primary_left' => array(), 'primary_left_center' => array(), 'primary_center' => array( 'logo' ), 'primary_right_center' => array(), 'primary_right' => array(), ); $theme_options['header-desktop-items']['below'] = array( 'below_left' => array(), 'below_left_center' => array(), 'below_center' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ), 'below_right_center' => array(), 'below_right' => array(), ); break; case 'header-main-layout-3': $theme_options['header-desktop-items']['primary'] = array( 'primary_left' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ), 'primary_left_center' => array(), 'primary_center' => array(), 'primary_right_center' => array(), 'primary_right' => array( 'logo' ), ); break; default: $theme_options['header-desktop-items']['primary'] = array( 'primary_left' => array( 'logo' ), 'primary_left_center' => array(), 'primary_center' => array(), 'primary_right_center' => array(), 'primary_right' => array( 'menu-1' ), ); } // Header : Primary Header - Mobile Layout. $mobile_layout = astra_get_option( 'header-main-menu-align' ); if ( 'stack' === $mobile_layout ) { $theme_options['header-mobile-items']['popup'] = array( 'popup_content' => ( '' !== $new_menu_item_mobile && '' !== $new_menu_item_mobile_outside ) ? array( 'menu-1', $new_menu_item_mobile ) : array( 'menu-1' ) ); $theme_options['header-mobile-items']['primary'] = array( 'primary_left' => array(), 'primary_center' => array( 'logo' ), 'primary_right' => array(), ); $theme_options['header-mobile-items']['below'] = array( 'below_left' => array(), 'below_center' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ), 'below_right' => array(), ); } else { $theme_options['header-mobile-items']['popup'] = array( 'popup_content' => ( '' !== $new_menu_item_mobile ) ? array( 'menu-1', $new_menu_item_mobile ) : array( 'menu-1' ) ); if ( 'header-main-layout-3' === $primary_header_layout ) { $theme_options['header-mobile-items']['primary'] = array( 'primary_left' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ), 'primary_center' => array(), 'primary_right' => array( 'logo' ), ); } else { $theme_options['header-mobile-items']['primary'] = array( 'primary_left' => array( 'logo' ), 'primary_center' => array(), 'primary_right' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ), ); } } // Header - Primary Header - Content Width. if ( isset( $theme_options['header-main-layout-width'] ) ) { $theme_options['hb-header-main-layout-width'] = $theme_options['header-main-layout-width']; } // Header - Primary Header - Border Bottom. if ( isset( $theme_options['header-main-sep'] ) ) { $theme_options['hb-header-main-sep'] = $theme_options['header-main-sep']; } if ( isset( $theme_options['header-main-sep-color'] ) ) { $theme_options['hb-header-main-sep-color'] = $theme_options['header-main-sep-color']; } if ( isset( $theme_options['header-bg-obj-responsive'] ) ) { $theme_options['hb-header-bg-obj-responsive'] = $theme_options['header-bg-obj-responsive']; } if ( isset( $theme_options['header-spacing'] ) ) { $theme_options['section-primary-header-builder-padding'] = $theme_options['header-spacing']; } return array( 'theme_options' => $theme_options, 'used_elements' => $used_elements, 'widget_options' => $widget_options, ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |