/**
  * pages with own url rewriting need their breadcrumbs created in a different way
  *
  * @param Controller $context        the current controller
  * @param int        $maxDepth       maximum levels
  * @param bool       $unlinked       link breadcrumbs elements
  * @param bool       $stopAtPageType name of PageType to stop at
  * @param bool       $showHidden     show pages that will not show in menus
  *
  * @return string html for breadcrumbs
  * 
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 04.03.2014
  */
 public function ContextBreadcrumbs($context, $maxDepth = 20, $unlinked = false, $stopAtPageType = false, $showHidden = false)
 {
     $page = $context;
     $parts = array();
     $contextObject = DataObject::get($context->getSection())->byID($this->getBreadcrumbElementID());
     if ($contextObject) {
         $parts[] = $contextObject->Title;
     }
     $i = 0;
     while ($page && (!$maxDepth || sizeof($parts) < $maxDepth) && (!$stopAtPageType || $page->ClassName != $stopAtPageType)) {
         if ($showHidden || $page->ShowInMenus || $page->ID == $this->ID) {
             if ($page->URLSegment == 'home') {
                 $hasHome = true;
             }
             if ($page->ID == $this->ID || $unlinked) {
                 $parts[] = Convert::raw2xml($page->Title);
             } else {
                 $parts[] = "<a href=\"" . $page->Link() . "\">" . Convert::raw2xml($page->Title) . "</a>";
             }
         }
         $page = $page->Parent;
     }
     return implode(" &raquo; ", array_reverse($parts));
 }
Example #2
0
 /**
  * pages with own url rewriting need their breadcrumbs created in a different way
  *
  * @param Controller $context        the current controller
  * @param int        $maxDepth       maximum levels
  * @param bool       $unlinked       link breadcrumbs elements
  * @param bool       $stopAtPageType ???
  * @param bool       $showHidden     show pages that will not show in menus
  *
  * @author Sascha Koehler <*****@*****.**>
  * @since 3.11.2010
  * @return string html for breadcrumbs
  */
 public function ContextBreadcrumbs($context, $maxDepth = 20, $unlinked = false, $stopAtPageType = false, $showHidden = false)
 {
     $page = $context;
     $parts = array();
     // Get address type
     $address = DataObject::get_by_id($context->getSection(), $this->urlParams['ID']);
     $parts[] = $address->i18n_singular_name();
     $i = 0;
     while ($page && (!$maxDepth || sizeof($parts) < $maxDepth) && (!$stopAtPageType || $page->ClassName != $stopAtPageType)) {
         if ($showHidden || $page->ShowInMenus || $page->ID == $this->ID) {
             if ($page->URLSegment == 'home') {
                 $hasHome = true;
             }
             if ($page->ID == $this->ID || $unlinked) {
                 $parts[] = Convert::raw2xml($page->Title);
             } else {
                 $parts[] = "<a href=\"" . $page->Link() . "\">" . Convert::raw2xml($page->Title) . "</a>";
             }
         }
         $page = $page->Parent;
     }
     return implode(" &raquo; ", array_reverse($parts));
 }