class CartStorageSelect in Basic cart 8
Same name and namespace in other branches
- 8.6 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
- 8.0 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
- 8.2 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
- 8.3 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
- 8.4 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
- 8.5 src/CartStorageSelect.php \Drupal\basic_cart\CartStorageSelect
Hierarchy
- class \Drupal\basic_cart\CartStorageSelect
Expanded class hierarchy of CartStorageSelect
1 file declares its use of CartStorageSelect
- Utility.php in src/
Utility.php - Contains \Drupal\basic_cart\Utility
File
- src/
CartStorageSelect.php, line 12 - Contains \Drupal\basic_cart\Utility
Namespace
Drupal\basic_cartView source
class CartStorageSelect {
private $cart = NULL;
private $cart_storage;
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;
}
}
public function getCart($nid = NULL) {
return $this->cart
->getCart($nid);
}
public function removeFromCart($nid) {
return $this->cart
->removeFromCart($nid);
}
public function emptyCart() {
return $this->cart
->emptyCart();
}
public function addToCart($id, $params = array()) {
return $this->cart
->addToCart($id, $params);
}
public function loggedInActionCart() {
return $this->cart
->loggedInActionCart();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CartStorageSelect:: |
private | property | ||
CartStorageSelect:: |
private | property | ||
CartStorageSelect:: |
public | function | ||
CartStorageSelect:: |
public | function | ||
CartStorageSelect:: |
public | function | ||
CartStorageSelect:: |
public | function | ||
CartStorageSelect:: |
public | function | ||
CartStorageSelect:: |
public | function |