Automattic\WooCommerce\Internal\Admin\Settings
PaymentsController::preload_settings
Preload settings to make them available to the Payments settings page frontend logic.
Added keys will be available in the window.wcSettings.admin object.
Method of the class: PaymentsController{}
No Hooks.
Returns
Array. Settings array with additional settings added.
Usage
$PaymentsController = new PaymentsController(); $PaymentsController->preload_settings( $settings );
- $settings(array)
- The settings array.
Default:array()
PaymentsController::preload_settings() PaymentsController::preload settings code WC 10.8.1
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;
}