Astra_Get_Preload_Local_Fonts::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/admin/settings/performance/class-astra-get-preload-local-fonts.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' )
			);
		}

		if ( ! class_exists( 'Astra_API_Init' ) ) {
			return Astra_Abilities_Response::error(
				__( 'Astra API not available.', 'astra' ),
				__( 'Please ensure Astra theme is properly loaded.', 'astra' )
			);
		}

		$enabled              = Astra_API_Init::get_admin_settings_option( 'preload_local_fonts', false );
		$load_locally_enabled = Astra_API_Init::get_admin_settings_option( 'self_hosted_gfonts', false );

		return Astra_Abilities_Response::success(
			__( 'Retrieved Preload Local Fonts status successfully.', 'astra' ),
			array(
				'enabled'               => (bool) $enabled,
				'enabled_label'         => $enabled ? 'Enabled' : 'Disabled',
				'load_locally_enabled'  => (bool) $load_locally_enabled,
				'load_locally_required' => ! $load_locally_enabled,
			)
		);
	}


User Contributed Notes

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