WC_Helper_Admin::add_marketplace_settings()public staticWC 1.0

Pushes settings onto the WooCommerce Admin global settings object (wcSettings).

Метод класса: WC_Helper_Admin{}

Хуков нет.

Возвращает

Разное. $settings

Использование

$result = WC_Helper_Admin::add_marketplace_settings( $settings );
$settings(разное) (обязательный)
The settings object we're amending.

Код WC_Helper_Admin::add_marketplace_settings() WC 9.4.2

public static function add_marketplace_settings( $settings ) {
	$auth_user_data  = WC_Helper_Options::get( 'auth_user_data', array() );
	$auth_user_email = isset( $auth_user_data['email'] ) ? $auth_user_data['email'] : '';

	// Get the all installed themes and plugins. Knowing this will help us decide to show Add to Store button on product cards.
	$installed_products = array_merge( WC_Helper::get_local_plugins(), WC_Helper::get_local_themes() );
	$installed_products = array_map(
		function ( $product ) {
			return $product['slug'];
		},
		$installed_products
	);

	$woo_connect_notice_type = WC_Helper_Updater::get_woo_connect_notice_type();

	$settings['wccomHelper'] = array(
		'isConnected'                => WC_Helper::is_site_connected(),
		'connectURL'                 => self::get_connection_url(),
		'userEmail'                  => $auth_user_email,
		'userAvatar'                 => get_avatar_url( $auth_user_email, array( 'size' => '48' ) ),
		'storeCountry'               => wc_get_base_location()['country'],
		'inAppPurchaseURLParams'     => WC_Admin_Addons::get_in_app_purchase_url_params(),
		'installedProducts'          => $installed_products,
		'wooUpdateManagerInstalled'  => WC_Woo_Update_Manager_Plugin::is_plugin_installed(),
		'wooUpdateManagerActive'     => WC_Woo_Update_Manager_Plugin::is_plugin_active(),
		'wooUpdateManagerInstallUrl' => WC_Woo_Update_Manager_Plugin::generate_install_url(),
		'wooUpdateManagerPluginSlug' => WC_Woo_Update_Manager_Plugin::WOO_UPDATE_MANAGER_SLUG,
		'wooUpdateCount'             => WC_Helper_Updater::get_updates_count_based_on_site_status(),
		'woocomConnectNoticeType'    => $woo_connect_notice_type,
		'dismissNoticeNonce'         => wp_create_nonce( 'dismiss_notice' ),
	);

	if ( WC_Helper::is_site_connected() ) {
		$settings['wccomHelper']['subscription_expired_notice']  = PluginsHelper::get_expired_subscription_notice( false );
		$settings['wccomHelper']['subscription_expiring_notice'] = PluginsHelper::get_expiring_subscription_notice( false );
		$settings['wccomHelper']['subscription_missing_notice']  = PluginsHelper::get_missing_subscription_notice();
	}

	return $settings;
}