/** * Return the document UID from the current matched route * @return string|NULL */ public function getDocumentUidFromRoute() { $params = $this->getController()->plugin('params'); $search = $this->routerOptions->getUidParam(); 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()); }