Support gateway objects in the $load_gateways array

Rather than requiring $load_gateways to be the string class names of the
payment gateways to load, support client code returning the actual
gateway instance from the 'woocommerce_payment_gateways' filter.  This
affords much more fine grained control over how, when, and how often, a
payment gateway is instantiated
This commit is contained in:
justinstern 2015-01-07 21:11:24 -05:00
parent 99095a7b57
commit 072e722406
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ class WC_Payment_Gateways {
// Load gateways in order
foreach ( $load_gateways as $gateway ) {
$load_gateway = new $gateway();
$load_gateway = is_string( $gateway ) ? new $gateway() : $gateway;
if ( isset( $ordering[ $load_gateway->id ] ) && is_numeric( $ordering[ $load_gateway->id ] ) ) {
// Add in position