function _commerce_braintree_express_checkout_enabled in Commerce Braintree 7.3
Is Express Checkout enabled or allowed for this order?
Parameters
null $order: An optional commerce order object.
Return value
bool TRUE if the payment method is available.
2 calls to _commerce_braintree_express_checkout_enabled()
- commerce_braintree_express_checkout_form_alter in modules/
commerce_braintree_express_checkout/ commerce_braintree_express_checkout.module - Implements hook_form_alter().
- commerce_braintree_express_checkout_form_views_form_commerce_cart_form_default_alter in modules/
commerce_braintree_express_checkout/ commerce_braintree_express_checkout.module - Implements hook_form_FORM_ID_alter().
File
- modules/
commerce_braintree_express_checkout/ commerce_braintree_express_checkout.module, line 400 - Provides integration PayPal Express Checkout for Braintree.
Code
function _commerce_braintree_express_checkout_enabled($order = NULL) {
if (!empty($order)) {
$order->payment_methods = array();
rules_invoke_all('commerce_payment_methods', $order);
uasort($order->payment_methods, 'drupal_sort_weight');
return in_array(COMMERCE_BRAINTREE_EXPRESS_CHECKOUT_INSTANCE_ID, array_keys($order->payment_methods));
}
$rule = rules_config_load('commerce_payment_braintree_express_checkout');
return !empty($rule->active);
}