Astra_Get_Scroll_To_Top::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/customizer/general/scroll-to-top/class-astra-get-scroll-to-top.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' )
			);
		}

		$colors = array(
			'icon_color'       => astra_get_option( 'scroll-to-top-icon-color', '' ),
			'icon_bg_color'    => astra_get_option( 'scroll-to-top-icon-bg-color', '' ),
			'icon_h_color'     => astra_get_option( 'scroll-to-top-icon-h-color', '' ),
			'icon_h_bg_color'  => astra_get_option( 'scroll-to-top-icon-h-bg-color', '' ),
		);

		$position_labels = array(
			'right' => 'Right',
			'left'  => 'Left',
		);

		$device_labels = array(
			'both'    => 'Both (Desktop & Mobile)',
			'desktop' => 'Desktop Only',
			'mobile'  => 'Mobile Only',
		);

		return Astra_Abilities_Response::success(
			__( 'Retrieved scroll-to-top settings successfully.', 'astra' ),
			array(
				'enabled'             => (bool) astra_get_option( 'scroll-to-top-enable', true ),
				'position'            => astra_get_option( 'scroll-to-top-icon-position', 'right' ),
				'on_devices'          => astra_get_option( 'scroll-to-top-on-devices', 'both' ),
				'icon_size'           => absint( astra_get_option( 'scroll-to-top-icon-size', 15 ) ),
				'colors'              => $colors,
				'border_radius'       => astra_get_option( 'scroll-to-top-icon-radius-fields', array() ),
				'available_positions' => $position_labels,
				'available_devices'   => $device_labels,
			)
		);
	}


User Contributed Notes

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