|
Perforce Chronicle 2012.2/486814
API Documentation
|
Extends Zend's breadcrumbs helper to support passing a menu object or id. More...
Public Member Functions | |
| breadcrumbs ($container=null) | |
| This is the breadcrumbs helper entry point. | |
| htmlify (Zend_Navigation_Page $page) | |
| Extends the parent htmlify method to deal with the pages without a corresponding page to link to, e.g. | |
Extends Zend's breadcrumbs helper to support passing a menu object or id.
| Menu_View_Helper_Breadcrumbs::breadcrumbs | ( | $ | container = null | ) |
This is the breadcrumbs helper entry point.
It has been extended to add support for passing a menu object or id (string).
If the menu exists, it will be fetched; otherwise, an empty container will be used.
| mixed | $container | optional - menu or container to operate on |
{
if ($container && !$container instanceof Zend_Navigation_Container) {
if (!$container instanceof P4Cms_Menu && P4Cms_Menu::exists($container)) {
$container = P4Cms_Menu::fetch($container);
}
if ($container instanceof P4Cms_Menu) {
// tag the page cache so it can be appropriately cleared later
if (P4Cms_Cache::canCache('page')) {
P4Cms_Cache::getCache('page')
->addTag('p4cms_menu')
->addTag('p4cms_menu_' . bin2hex($container->getId()));
}
$container = $container->getExpandedContainer();
} else {
$container = new Zend_Navigation;
}
}
if (null !== $container) {
$this->setContainer($container);
}
return $this;
}
| Menu_View_Helper_Breadcrumbs::htmlify | ( | Zend_Navigation_Page $ | page | ) |
Extends the parent htmlify method to deal with the pages without a corresponding page to link to, e.g.
heading menu items.
| Zend_Navigation_Page | $page | page to generate HTML for |
{
// if there is a url, use the parent's htmlify method
if ($page->getHref()) {
return parent::htmlify($page);
}
// if there is NO url defined, don't add the <a> tag.
// get label for translating
$label = $page->getLabel();
if ($this->getUseTranslator() && $t = $this->getTranslator()) {
if (is_string($label) && !empty($label)) {
$label = $t->translate($label);
}
}
return $this->view->escape($label);
}