You are here

public static function Utility::getCart in Basic cart 8.0

Same name and namespace in other branches
  1. 8.6 src/Utility.php \Drupal\basic_cart\Utility::getCart()
  2. 8 src/Utility.php \Drupal\basic_cart\Utility::getCart()
  3. 8.2 src/Utility.php \Drupal\basic_cart\Utility::getCart()
  4. 8.3 src/Utility.php \Drupal\basic_cart\Utility::getCart()
  5. 8.4 src/Utility.php \Drupal\basic_cart\Utility::getCart()
  6. 8.5 src/Utility.php \Drupal\basic_cart\Utility::getCart()

Function for shopping cart retrieval.

Parameters

int $nid: We are using the node id to store the node in the shopping cart

Return value

mixed Returning the shopping cart contents. An empty array if there is nothing in the cart

4 calls to Utility::getCart()
basic_cart_get_cart in ./basic_cart.inc
CartForm::buildForm in src/Form/CartForm.php
Form constructor.
Utility::getCartData in src/Utility.php
Utility::quantityPrefixData in src/Utility.php

File

src/Utility.php, line 49
Contains \Drupal\basic_cart\Utility

Class

Utility

Namespace

Drupal\basic_cart

Code

public static function getCart($nid = NULL) {
  $storage = static::getStorage();
  return $storage
    ->getCart($nid);
}