/** * Default constructor * * @return void */ public function __construct() { // call parent parent::__construct(); // add into the reference Spoon::set('breadcrumb', $this); // get more information for the homepage $homeInfo = FrontendNavigation::getPageInfo(1); // add homepage as first item (with correct element) $this->addElement($homeInfo['navigation_title'], FrontendNavigation::getURL(1)); // get other pages $pages = $this->URL->getPages(); // init vars $items = array(); $errorURL = FrontendNavigation::getUrl(404); // loop pages while (!empty($pages)) { // init vars $URL = implode('/', $pages); $menuId = FrontendNavigation::getPageId($URL); $pageInfo = FrontendNavigation::getPageInfo($menuId); // do we know something about the page if ($pageInfo !== false && isset($pageInfo['navigation_title'])) { // only add pages that aren't direct actions if ($pageInfo['tree_type'] != 'direct_action') { // get URL $pageURL = FrontendNavigation::getUrl($menuId); // if this is the error-page, so we won't show an URL. if ($pageURL == $errorURL) { $pageURL = null; } // add to the items $items[] = array('title' => $pageInfo['navigation_title'], 'url' => $pageURL); } } // remove element array_pop($pages); } // reverse so everything is in place krsort($items); // loop and add elements foreach ($items as $row) { $this->addElement($row['title'], $row['url']); } }