WC_Payment_Gateways::normalize_gateway_settings_for_transition
Normalize gateway settings for transition handling.
Method of the class: WC_Payment_Gateways{}
No Hooks.
Returns
array. Normalized gateway settings.
Usage
// private - for code of main (parent) class only $result = $this->normalize_gateway_settings_for_transition( $gateway, $settings );
- $gateway(WC_Payment_Gateway) (required)
- Payment gateway.
- $settings(mixed) (required)
- Gateway settings.
WC_Payment_Gateways::normalize_gateway_settings_for_transition() WC Payment Gateways::normalize gateway settings for transition code WC 11.1.2
private function normalize_gateway_settings_for_transition( $gateway, $settings ) {
if ( is_array( $settings ) ) {
return $settings;
}
$form_fields = $gateway->get_form_fields();
$enabled_field = $form_fields['enabled'] ?? array();
$enabled_default = $gateway->get_field_default( $enabled_field );
return array( 'enabled' => 'yes' === $enabled_default ? 'yes' : 'no' );
}