Perforce Chronicle 2012.2/486814
API Documentation
|
Specialized breadcrumb helper that takes a category and produces breadcrumbs for it. More...
Public Member Functions | |
categoryBreadcrumbs ($category) | |
Render breadcrumbs for the given category. |
Specialized breadcrumb helper that takes a category and produces breadcrumbs for it.
Category_View_Helper_CategoryBreadcrumbs::categoryBreadcrumbs | ( | $ | category | ) |
Render breadcrumbs for the given category.
Category_Model_Category | $category | the category to render breadcrumbs for. |
{ // prepare breadcrumbs. $breadcrumbs = new Zend_Navigation( array( array( 'label' => 'Categories', 'module' => 'category', 'controller' => 'index', 'action' => 'index', 'active' => true ) ) ); // add category ancestry to breadcrumbs. if ($category instanceof Category_Model_Category) { $container = $breadcrumbs->current(); $crumbs = $category->getAncestors(); $crumbs[] = $category; foreach ($crumbs as $crumb) { $page = Zend_Navigation_Page::factory( array( 'uri' => $crumb->getUri(), 'label' => $crumb->getTitle(), 'active' => true, ) ); // add page to parent container and advance container pointer. $container->addPage($page); $container = $page; } } return parent::breadcrumbs($breadcrumbs)->setSeparator('<span class="separator"><span>></span></span>'); }