Пример #1
0
 /**
  * For the curret page, return the text that will be used for that pages canonical path. This happens before
  * any uniqueness checks get run.
  *
  * @return string
  */
 protected function computeCanonicalPagePath()
 {
     $parent = Page::getByID($this->cParentID);
     $parentPath = $parent->getCollectionPathObject();
     $path = '';
     if ($parentPath instanceof PagePath) {
         $path = $parentPath->getPagePath();
     }
     $path .= '/';
     $cID = $this->getCollectionPointerOriginalID() > 0 ? $this->getCollectionPointerOriginalID() : $this->cID;
     /** @var \Concrete\Core\Utility\Service\Validation\Strings $stringValidator */
     $stringValidator = Core::make('helper/validation/strings');
     if ($stringValidator->notempty($this->getCollectionHandle())) {
         $path .= $this->getCollectionHandle();
     } else {
         $path .= $cID;
     }
     $event = new PagePathEvent($this);
     $event->setPagePath($path);
     $event = Events::dispatch('on_compute_canonical_page_path', $event);
     return $event->getPagePath();
 }
Пример #2
0
 /**
  * For the curret page, return the text that will be used for that pages canonical path. This happens before
  * any uniqueness checks get run.
  *
  * @return string
  */
 protected function computeCanonicalPagePath()
 {
     $parent = Page::getByID($this->cParentID);
     $parentPath = $parent->getCollectionPathObject();
     $path = '';
     if ($parentPath instanceof PagePath) {
         $path = $parentPath->getPagePath();
     }
     $path .= '/';
     $cID = $this->getCollectionPointerOriginalID() > 0 ? $this->getCollectionPointerOriginalID() : $this->cID;
     $path .= $this->getCollectionHandle() ? $this->getCollectionHandle() : $cID;
     $event = new PagePathEvent($this);
     $event->setPagePath($path);
     $event = Events::dispatch('on_compute_canonical_page_path', $event);
     return $event->getPagePath();
 }
Пример #3
0
 /**
  * For the curret page, return the text that will be used for that pages canonical path. This happens before
  * any uniqueness checks get run.
  *
  * @return string
  */
 protected function computeCanonicalPagePath()
 {
     $parent = self::getByID($this->cParentID);
     $parentPath = $parent->getCollectionPathObject();
     $path = '';
     if ($parentPath instanceof PagePath) {
         $path = $parentPath->getPagePath();
     }
     $path .= '/';
     $cID = $this->getCollectionPointerOriginalID() > 0 ? $this->getCollectionPointerOriginalID() : $this->cID;
     /** @var \Concrete\Core\Utility\Service\Validation\Strings $stringValidator */
     $stringValidator = Core::make('helper/validation/strings');
     if ($stringValidator->notempty($this->getCollectionHandle())) {
         $path .= $this->getCollectionHandle();
     } else {
         if (!$this->isHomePage()) {
             $path .= $cID;
         } else {
             $path = '';
             // This is computing the path for the home page, which has no handle, and so shouldn't have a segment.
         }
     }
     $event = new PagePathEvent($this);
     $event->setPagePath($path);
     $event = Events::dispatch('on_compute_canonical_page_path', $event);
     return $event->getPagePath();
 }