Astra_Get_Header_Builder::execute( array $args )
Execute the ability.
Description
Parameters
- $args
-
(array) (Required) Input arguments.
Return
(array) Result array.
Source
File: inc/abilities/customizer/header/class-astra-get-header-builder.php
public function execute( $args ) {
if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
return Astra_Abilities_Response::error(
__( 'Astra theme is not active.', 'astra' ),
__( 'Please activate the Astra theme to use this feature.', 'astra' )
);
}
$desktop_items = astra_get_option( 'header-desktop-items', array() );
$mobile_items = astra_get_option( 'header-mobile-items', array() );
$mobile_popup_items = astra_get_option( 'header-mobile-popup-items', array() );
$default_desktop = array(
'popup' => array(
'popup_content' => array(),
),
'above' => array(
'above_left' => array(),
'above_left_center' => array(),
'above_center' => array(),
'above_right_center' => array(),
'above_right' => array(),
),
'primary' => array(
'primary_left' => array(),
'primary_left_center' => array(),
'primary_center' => array(),
'primary_right_center' => array(),
'primary_right' => array(),
),
'below' => array(
'below_left' => array(),
'below_left_center' => array(),
'below_center' => array(),
'below_right_center' => array(),
'below_right' => array(),
),
);
$default_mobile = array(
'popup' => array(
'popup_content' => array(),
),
'above' => array(
'above_left' => array(),
'above_center' => array(),
'above_right' => array(),
),
'primary' => array(
'primary_left' => array(),
'primary_center' => array(),
'primary_right' => array(),
),
'below' => array(
'below_left' => array(),
'below_center' => array(),
'below_right' => array(),
),
);
$default_popup = array(
'popup' => array(
'popup_content' => array(),
),
);
$desktop_items = is_array( $desktop_items ) ? $this->array_merge_recursive_distinct( $default_desktop, $desktop_items ) : $default_desktop;
$mobile_items = is_array( $mobile_items ) ? $this->array_merge_recursive_distinct( $default_mobile, $mobile_items ) : $default_mobile;
$mobile_popup_items = is_array( $mobile_popup_items ) ? $this->array_merge_recursive_distinct( $default_popup, $mobile_popup_items ) : $default_popup;
$available_components = array(
'logo' => 'Logo',
'button-1' => 'Button 1',
'button-2' => 'Button 2',
'button-3' => 'Button 3',
'html-1' => 'HTML 1',
'html-2' => 'HTML 2',
'html-3' => 'HTML 3',
'menu-1' => 'Primary Menu',
'menu-2' => 'Secondary Menu',
'mobile-menu' => 'Mobile Menu',
'mobile-trigger' => 'Mobile Trigger',
'widget-1' => 'Widget 1',
'widget-2' => 'Widget 2',
'widget-3' => 'Widget 3',
'social-icons-1' => 'Social Icons 1',
'social-icons-2' => 'Social Icons 2',
'search' => 'Search',
'woo-cart' => 'WooCommerce Cart',
'edd-cart' => 'EDD Cart',
'account' => 'Account',
'language-switcher' => 'Language Switcher',
);
return Astra_Abilities_Response::success(
__( 'Retrieved header builder settings successfully.', 'astra' ),
array(
'desktop' => $desktop_items,
'mobile' => $mobile_items,
'mobile_popup' => $mobile_popup_items,
'available_components' => $available_components,
)
);
}
Expand full source code Collapse full source code View on Trac