WC_REST_Payment_Gateways_Controller::get_settings()
Return settings associated with this payment gateway.
Метод класса: WC_REST_Payment_Gateways_Controller{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_REST_Payment_Gateways_Controller = new WC_REST_Payment_Gateways_Controller(); $WC_REST_Payment_Gateways_Controller->get_settings( $gateway );
- $gateway(WC_Payment_Gateway) (обязательный)
- Gateway instance.
Код WC_REST_Payment_Gateways_Controller::get_settings() WC REST Payment Gateways Controller::get settings WC 9.3.3
public function get_settings( $gateway ) { $settings = array(); $gateway->init_form_fields(); foreach ( $gateway->form_fields as $id => $field ) { // Make sure we at least have a title and type. if ( empty( $field['title'] ) || empty( $field['type'] ) ) { continue; } // Ignore 'enabled' and 'description' which get included elsewhere. if ( in_array( $id, array( 'enabled', 'description' ), true ) ) { continue; } $data = array( 'id' => $id, 'label' => empty( $field['label'] ) ? $field['title'] : $field['label'], 'description' => empty( $field['description'] ) ? '' : $field['description'], 'type' => $field['type'], 'value' => empty( $gateway->settings[ $id ] ) ? '' : $gateway->settings[ $id ], 'default' => empty( $field['default'] ) ? '' : $field['default'], 'tip' => empty( $field['description'] ) ? '' : $field['description'], 'placeholder' => empty( $field['placeholder'] ) ? '' : $field['placeholder'], ); if ( ! empty( $field['options'] ) ) { $data['options'] = $field['options']; } $settings[ $id ] = $data; } return $settings; }