Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function loadBreadcrumb($uuid, $locale, $webspaceKey)
 {
     $document = $this->documentManager->find($uuid, $locale);
     $documents = array();
     $contentDocument = $this->getContentDocument($webspaceKey, $locale);
     $contentDepth = $this->inspector->getDepth($contentDocument);
     $document = $this->inspector->getParent($document);
     $documentDepth = $this->inspector->getDepth($document);
     while ($document instanceof StructureBehavior && $documentDepth >= $contentDepth) {
         $documents[] = $document;
         $document = $this->inspector->getParent($document);
         $documentDepth = $this->inspector->getDepth($document);
     }
     $items = array();
     foreach ($documents as $document) {
         $items[] = new BreadcrumbItem($this->inspector->getDepth($document) - $contentDepth, $this->inspector->getUuid($document), $document->getTitle());
     }
     $items = array_reverse($items);
     return $items;
 }