Astra_Get_Footer_Builder_Design::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-design.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' )
);
}
$section = isset( $args['section'] ) ? $args['section'] : null;
$sections = array( 'above', 'primary', 'below' );
if ( $section && ! in_array( $section, $sections, true ) ) {
return Astra_Abilities_Response::error(
__( 'Invalid section provided.', 'astra' ),
__( 'Section must be one of: above, primary, below.', 'astra' )
);
}
$sections_to_fetch = $section ? array( $section ) : $sections;
$design_options = array();
foreach ( $sections_to_fetch as $sect ) {
$prefix = $this->get_section_prefix( $sect );
$section_id = $this->get_section_id( $sect );
$design_options[ $sect ] = array(
'background' => astra_get_option( $prefix . '-bg-obj-responsive', array() ),
'border_color' => astra_get_option( $prefix . '-top-border-color', '' ),
'border_size' => astra_get_option( $prefix . '-separator', 0 ),
'padding' => astra_get_option( $section_id . '-padding', array() ),
'margin' => astra_get_option( $section_id . '-margin', array() ),
);
}
return Astra_Abilities_Response::success(
__( 'Retrieved footer builder design options successfully. IMPORTANT: When presenting any colors to the user, you MUST show visual color previews using this markdown format if valid color code:  `#HEXCODE` - Replace HEXCODE with the actual hex color value.', 'astra' ),
$design_options
);
}
Expand full source code Collapse full source code View on Trac