You are here

public function CurrentUserCartIds::getArgument in Commerce Core 8.2

Return the default argument.

This needs to be overridden by every default argument handler to properly do what is needed.

Overrides ArgumentDefaultPluginBase::getArgument

File

modules/cart/src/Plugin/views/argument_default/CurrentUserCartIds.php, line 51

Class

CurrentUserCartIds
Default argument plugin for the current user's carts.

Namespace

Drupal\commerce_cart\Plugin\views\argument_default

Code

public function getArgument() {

  // Note that we only need the order IDS here, but the cart provider loads
  // the orders even when getCartIds() is called.
  $carts = array_filter($this->cartProvider
    ->getCarts(), function ($cart) {

    /** @var \Drupal\commerce_order\Entity\OrderInterface $cart */
    return $cart
      ->hasItems();
  });
  return implode('+', array_keys($carts));
}