public function CartController::cart in Basic cart 8
Same name and namespace in other branches
- 8.6 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
- 8.0 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
- 8.2 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
- 8.3 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
- 8.4 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
- 8.5 src/Controller/CartController.php \Drupal\basic_cart\Controller\CartController::cart()
1 string reference to 'CartController::cart'
File
- src/
Controller/ CartController.php, line 32 - Contains \Drupal\basic_cart\Controller\CartController.
Class
- CartController
- Contains the cart controller.
Namespace
Drupal\basic_cart\ControllerCode
public function cart() {
\Drupal::service('page_cache_kill_switch')
->trigger();
$utility = new Utility();
$cart = $utility::getCart();
$config = $utility::cartSettings();
$request = \Drupal::request();
if ($route = $request->attributes
->get(\Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_OBJECT)) {
$route
->setDefault('_title', t($config
->get('cart_page_title')));
}
return !empty($cart['cart']) ? \Drupal::formBuilder()
->getForm('\\Drupal\\basic_cart\\Form\\CartForm') : array(
'#type' => 'markup',
'#markup' => t($config
->get('empty_cart')),
);
}