crumbs.commerce_checkout.inc in Crumbs, the Breadcrumbs suite 7.2
File
plugins/crumbs.commerce_checkout.inc
View source
<?php
function commerce_checkout_crumbs_plugins($api) {
$api
->routeMonoPlugin('checkout/%/%', 'checkoutPages');
$api
->routeParentPath('checkout/%', 'cartToCheckout', 'cart');
$api
->disabledByDefault('*');
}
class commerce_checkout_CrumbsMonoPlugin_checkoutPages implements crumbs_MonoPlugin_FindParentInterface, crumbs_MonoPlugin_FindTitleInterface {
function describe($api) {
$api
->titleWithLabel(t('Previous page in checkout process'), t('Parent'));
}
function findParent($path, $item) {
if (empty($item['map'][2])) {
return NULL;
}
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 {
return 'cart';
}
}
function findTitle($path, $item) {
if (empty($item['map'][2]['name'])) {
return NULL;
}
if (!is_object($item['map'][1])) {
return NULL;
}
list(, $order, $page) = $item['map'];
return t($page['name']);
}
}