You are here

function _uc_ajax_admin_build_checkout_form in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_ajax_admin/uc_ajax_admin.module \_uc_ajax_admin_build_checkout_form()

Builds the checkout form, using the cart order if it exists, or a default shippable order if not.

1 call to _uc_ajax_admin_build_checkout_form()
AjaxAdminForm::buildForm in uc_ajax_admin/src/Form/AjaxAdminForm.php

File

uc_ajax_admin/uc_ajax_admin.module, line 142
Configures Ajax behaviours on the Ubercart checkout page.

Code

function _uc_ajax_admin_build_checkout_form() {
  $session = \Drupal::service('session');
  $order = Order::load($session
    ->get('cart_order'));
  if (!$order) {
    $order = Order::create([]);
    $order->products = [
      OrderProduct::create([
        'title' => 'fake',
        'nid' => 0,
        'qty' => 1,
        'cost' => 1,
        'price' => 1,
        'data' => [
          'shippable' => TRUE,
        ],
        'model' => 0,
        'weight' => 0,
      ]),
    ];
  }
  return \Drupal::formBuilder()
    ->getForm('\\Drupal\\uc_cart\\Form\\CheckoutForm', $order);
}