Automattic\WooCommerce\Internal\Admin\Settings

PaymentsController::preload_settingspublicWC 1.0

Preload settings to make them available to the Payments settings page frontend logic.

Added keys will be available in the window.wcSettings.admin object.

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

Хуков нет.

Возвращает

Массив. Settings array with additional settings added.

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

$PaymentsController = new PaymentsController();
$PaymentsController->preload_settings( $settings );
$settings(массив)
The settings array.
По умолчанию: array()

Код PaymentsController::preload_settings() WC 10.4.3

public function preload_settings( $settings = array() ) {
	// We only preload settings in the WP admin.
	if ( ! is_admin() ) {
		return $settings;
	}

	// Reset the received value if the type is invalid.
	if ( ! is_array( $settings ) ) {
		$settings = array();
	}

	// Add the business location country to the settings.
	if ( ! isset( $settings[ Payments::PAYMENTS_NOX_PROFILE_KEY ] ) ) {
		$settings[ Payments::PAYMENTS_NOX_PROFILE_KEY ] = array();
	}
	$settings[ Payments::PAYMENTS_NOX_PROFILE_KEY ]['business_country_code'] = $this->payments->get_country();

	return $settings;
}