Beispiel #1
0
 /**
  * Return the document id from the current matched route
  * @return string|NULL
  */
 public function getDocumentIdFromRoute()
 {
     $params = $this->getController()->plugin('params');
     $search = $this->routerOptions->getIdParam();
     return $params->fromRoute($search);
 }
 /**
  * Create Prismic specific Route Paramters from the given Document Link according to routing options
  * @param  DocumentLink $link
  * @return array
  */
 public function getRouteParams(DocumentLink $link)
 {
     $document = $this->getContext()->getDocumentById($link->getId());
     $bookmark = $this->getContext()->findBookmarkByDocument($document);
     return array($this->routerOptions->getIdParam() => $link->getId(), $this->routerOptions->getUidParam() => $link->getUid(), $this->routerOptions->getMaskParam() => $document->getType(), $this->routerOptions->getBookmarkParam() => $bookmark, $this->routerOptions->getRefParam() => $this->getContext()->getRefAsString(), $this->routerOptions->getSlugParam() => $document->getSlug());
 }