You are here

function commerce_checkout_CrumbsMonoPlugin_checkoutPages::findParent in Crumbs, the Breadcrumbs suite 7.2

Find candidates for the parent path.

Parameters

string $path: The path that we want to find a parent for.

array $item: Item as returned from crumbs_get_router_item()

Return value

string Parent path candidate.

Overrides crumbs_MonoPlugin_FindParentInterface::findParent

File

plugins/crumbs.commerce_checkout.inc, line 34

Class

commerce_checkout_CrumbsMonoPlugin_checkoutPages

Code

function findParent($path, $item) {

  // $item['map'][2] should contain the checkout step.
  if (empty($item['map'][2])) {
    return NULL;
  }

  // $item['map'][1] should contain the order.
  if (!is_object($item['map'][1])) {
    return NULL;
  }
  list(, $order, $page) = $item['map'];
  if (!empty($page['prev_page'])) {
    return 'checkout/' . $order->order_id . '/' . $page['prev_page'];
  }
  else {

    // If the step has no 'prev_page', then the parent is 'cart'.
    return 'cart';
  }
}