Exemplo n.º 1
0
 /**
  * Gets the breadcrumbs of a node
  * @param \ride\library\cms\node\Node $node
  * @param string $baseScript Base script for the node routes
  * @param string $locale Code of the locale
  * @return array Array with the URL as key and the node name as value
  */
 public function getBreadcrumbsForNode(Node $node, $baseScript, $locale)
 {
     $urls = array();
     if (!$node->hideInBreadcrumbs()) {
         $urls[$baseScript . $node->getRoute($locale)] = $node->getName($locale, 'breadcrumb');
     }
     $parent = $node->getParentNode();
     while ($parent) {
         $nodeType = $this->nodeTypeManager->getNodeType($parent->getType());
         if (($nodeType->getFrontendCallback() || $parent->getLevel() === 0) && !$parent->hideInBreadcrumbs()) {
             $url = $baseScript . $parent->getRoute($locale);
             $urls[$url] = $parent->getName($locale, 'breadcrumb');
         }
         $parent = $parent->getParentNode();
     }
     $urls = array_reverse($urls, true);
     return $urls;
 }