public function CartController::checkout in Basic cart 8
Same name and namespace in other branches
- 8.6 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
- 8.0 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
- 8.2 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
- 8.3 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
- 8.4 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
- 8.5 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::checkout()
1 string reference to 'CartController::checkout'
File
- src/
Controller/ CartController.php, line 75 - Contains \Drupal\basic_cart\Controller\CartController.
Class
- CartController
- Contains the cart controller.
Namespace
Drupal\basic_cart\ControllerCode
public function checkout() {
$utility = new Utility();
$cart = $utility::getCart();
if (isset($cart['cart']) && !empty($cart['cart'])) {
$type = node_type_load("basic_cart_order");
$node = $this
->entityManager()
->getStorage('node')
->create(array(
'type' => $type
->id(),
));
$node_create_form = $this
->entityFormBuilder()
->getForm($node);
return array(
'#type' => 'markup',
'#markup' => render($node_create_form),
);
}
else {
$url = new Url('basic_cart.cart');
return new RedirectResponse($url
->toString());
}
}