forked from gsteel/php-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
102 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace My; | ||
|
||
use Prismic\LinkResolverAbstract; | ||
use Prismic\Document\Fragment\Link\DocumentLink; | ||
|
||
class LinkResolverExample extends LinkResolverAbstract | ||
{ | ||
|
||
protected function resolveDocumentLink(DocumentLink $link) :? string | ||
{ | ||
/** | ||
* The document link provided has the following methods to help construct your | ||
* application specific URL | ||
* | ||
* $link->getId() - Universally Unique Document Identifier, i.e. Wxy8hRtk_r | ||
* $link->getUid() - Unique to each TYPE of document, i.e. 'about-us'. | ||
* - The UID is guaranteed to exist if your document type has a specific UID field | ||
* $link->getType() - The type of document, i.e. 'web-page' | ||
* $link->getSlug() - Computed by prismic, based normally on a heading somewhere, i.e. 'the-document-title' | ||
* $link->getTags() - An array of tags where each element is a string | ||
* $link->getLang() - The language of the document | ||
*/ | ||
|
||
return sprintf('/app/%s/%s', $link->getType(), $link->getUid()); | ||
} | ||
|
||
} |