Astra_Get_Footer_Builder::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/customizer/footer/class-astra-get-footer-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( 'footer-desktop-items', array() );
		$mobile_items  = astra_get_option( 'footer-mobile-items', array() );

		$default_desktop = 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(),
			),
		);

		$default_mobile = array(
			'above'   => array(
				'above_1' => array(),
				'above_2' => array(),
			),
			'primary' => array(
				'primary_1' => array(),
				'primary_2' => array(),
			),
			'below'   => array(
				'below_1' => array(),
				'below_2' => 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;

		$above_footer_columns   = astra_get_option( 'hba-footer-column', '3' );
		$primary_footer_columns = astra_get_option( 'hb-footer-column', '3' );
		$below_footer_columns   = astra_get_option( 'hbb-footer-column', '1' );

		$above_footer_layout   = astra_get_option( 'hba-footer-layout', 'full' );
		$primary_footer_layout = astra_get_option( 'hb-footer-layout', 'full' );
		$below_footer_layout   = astra_get_option( 'hbb-footer-layout', 'full' );

		$available_components = array(
			'copyright'      => 'Copyright',
			'menu'           => 'Footer Menu',
			'widget-1'       => 'Widget 1',
			'widget-2'       => 'Widget 2',
			'widget-3'       => 'Widget 3',
			'widget-4'       => 'Widget 4',
			'social-icons-1' => 'Social Icons 1',
			'social-icons-2' => 'Social Icons 2',
			'html-1'         => 'HTML 1',
			'html-2'         => 'HTML 2',
			'html-3'         => 'HTML 3',
			'button-1'       => 'Button 1',
			'button-2'       => 'Button 2',
		);

		return Astra_Abilities_Response::success(
			__( 'Retrieved footer builder settings successfully.', 'astra' ),
			array(
				'desktop'                => $desktop_items,
				'mobile'                 => $mobile_items,
				'above_footer_columns'   => (int) $above_footer_columns,
				'primary_footer_columns' => (int) $primary_footer_columns,
				'below_footer_columns'   => (int) $below_footer_columns,
				'above_footer_layout'    => $above_footer_layout,
				'primary_footer_layout'  => $primary_footer_layout,
				'below_footer_layout'    => $below_footer_layout,
				'available_components'   => $available_components,
			)
		);
	}


User Contributed Notes

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