Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\PaymentGateways\Schema
AbstractPaymentGatewaySettingsSchema::get_values
Get flat key-value mapping of all setting values.
Method of the class: AbstractPaymentGatewaySettingsSchema{}
No Hooks.
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->get_values( $gateway ): array;
- $gateway(WC_Payment_Gateway) (required)
- Gateway instance.
AbstractPaymentGatewaySettingsSchema::get_values() AbstractPaymentGatewaySettingsSchema::get values code WC 10.4.3
private function get_values( WC_Payment_Gateway $gateway ): array {
$values = array();
$gateway->init_form_fields();
foreach ( $gateway->form_fields as $id => $field ) {
$field_type = $field['type'] ?? '';
// Skip non-data fields.
if ( in_array( $field_type, array( 'title', 'sectionend' ), true ) ) {
continue;
}
// Get value from gateway settings.
$values[ $id ] = $gateway->settings[ $id ] ?? ( $field['default'] ?? '' );
}
// Add special fields for this gateway.
$special_fields = $this->get_special_field_values( $gateway );
$values = array_merge( $values, $special_fields );
return $values;
}