function uc_payment_form_uc_cart_view_form_alter in Ubercart 8.4
Same name and namespace in other branches
- 7.3 payment/uc_payment/uc_payment.module \uc_payment_form_uc_cart_view_form_alter()
Implements hook_form_FORM_ID_alter() for uc_cart_view_form().
Adds express buttons for enabled payment methods directly to the cart page.
File
- payment/
uc_payment/ uc_payment.module, line 56 - Defines the payment API that lets payment modules interact with Ubercart.
Code
function uc_payment_form_uc_cart_view_form_alter(&$form, FormStateInterface $form_state) {
$methods = PaymentMethod::loadMultiple();
foreach ($methods as $method) {
$plugin = $method
->getPlugin();
if ($plugin instanceof ExpressPaymentMethodPluginInterface) {
$form['actions']['checkout'][$method
->id()] = $plugin
->getExpressButton($method
->id());
}
}
}