public function CartStorageSelect::__construct in Basic cart 8
Same name and namespace in other branches
- 8.6 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
- 8.0 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
- 8.2 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
- 8.3 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
- 8.4 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
- 8.5 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect::__construct()
File
- src/
CartStorageSelect.php, line 17 - Contains \Drupal\basic_cart\Utility
Class
Namespace
Drupal\basic_cartCode
public function __construct($user, $use_table = NULL) {
$enable = $user
->id() && $use_table ? $user
->id() : 0;
switch ($enable) {
case 0:
$this->cart = new CartSession($user);
break;
default:
$cart_storage = new CartStorage();
$this->cart = new CartTable($cart_storage, $user);
break;
}
}