/**
  * Handle the command.
  */
 public function handle()
 {
     if ($parent = $this->page->getParent()) {
         if ($parent->isHome()) {
             return $parent->getSlug() . '/' . $this->page->getSlug();
         } else {
             return $parent->getPath() . '/' . $this->page->getSlug();
         }
     } elseif ($this->page->isHome()) {
         return '/';
     } else {
         return '/' . $this->page->getSlug();
     }
 }
Beispiel #2
0
 /**
  * Handle the command.
  */
 public function handle()
 {
     if (!$this->page->isEnabled()) {
         $path = 'pages/preview/' . $this->page->getStrId();
     } else {
         if ($parent = $this->page->getParent()) {
             $path = $parent->getPath() . '/' . $this->page->getSlug();
         } elseif ($this->page->isHome()) {
             $path = '/';
         } else {
             $path = '/' . $this->page->getSlug();
         }
     }
     $this->page->setAttribute('path', $path);
 }
 /**
  * Load the parent breadcrumbs.
  *
  * @param PageInterface $page
  * @param array         $breadcrumbs
  */
 protected function loadParent(PageInterface $page, array &$breadcrumbs)
 {
     if ($parent = $page->getParent()) {
         $breadcrumbs[$parent->getTitle()] = $parent->getPath();
         $this->loadParent($parent, $breadcrumbs);
     }
 }