You are here

function commerce_cart_plugin_argument_default_current_cart_order_id::get_argument in Commerce Core 7

Return the default argument.

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

Overrides views_plugin_argument_default::get_argument

File

modules/cart/includes/views/handlers/commerce_cart_plugin_argument_default_current_cart_order_id.inc, line 12
Contains a default argument plugin to return the current user's cart order ID.

Class

commerce_cart_plugin_argument_default_current_cart_order_id
Default argument plugin to get the current user's cart order ID.

Code

function get_argument() {
  global $user;
  $order_id = commerce_cart_order_id($user->uid);

  // Return an explicit 0 if not found instead of FALSE or NULL, as the
  // argument provided will be used to attempt a commerce_order_load() that
  // must accept an integer as the order ID.
  if (empty($order_id)) {
    return 0;
  }
  return $order_id;
}