Astra_Update_Sticky_Sidebar::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/customizer/general/sidebar/class-astra-update-sticky-sidebar.php

	public function execute( $args ) {
		if ( ! isset( $args['enabled'] ) ) {
			return Astra_Abilities_Response::error(
				__( 'Enabled status is required.', 'astra' ),
				__( 'Please provide enabled as true or false.', 'astra' )
			);
		}

		$enabled = (bool) $args['enabled'];

		astra_update_option( 'site-sticky-sidebar', $enabled );

		$message = sprintf(
			/* translators: %s: enabled or disabled */
			__( 'Sticky sidebar %s.', 'astra' ),
			$enabled ? __( 'enabled', 'astra' ) : __( 'disabled', 'astra' )
		);

		return Astra_Abilities_Response::success(
			$message,
			array(
				'updated' => true,
				'enabled' => $enabled,
			)
		);
	}


User Contributed Notes

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