Prismic.io PHP kit  3.0.0
Public Member Functions | List of all members
Prismic\LinkResolver Class Reference

Public Member Functions

 resolve ($link)
 
 __invoke ($link)
 
 resolveDocument ($document)
 
 resolveLink ($link)
 
 isBookmarkDocument ($api, $document, $bookmark)
 
 isBookmark ($api, $link, $bookmark)
 

Detailed Description

The LinkResolver convert prismic.io's links into your application's ones. Since prismic.io can't possibly know how to resolve internal links into usable ones for your application, you have to teach it! That way, you can pass this knowledge as a LinkResolver object into any operation that may have to resolve URLs (such as calling asHtml() on StructuredText or Link fragments).

If you're using a starter project, it usually comes with a basic linkResolver object, located at a relevant place, and made available everywhere in your application.

Read the last paragraph of prismic.io's API documentation to better understand the idea.

Member Function Documentation

§ __invoke()

Prismic\LinkResolver::__invoke (   $link)

What happens when the link resolver gets called.

Parameters
DocumentLink$linkThe document link
Returns
string

§ isBookmark()

Prismic\LinkResolver::isBookmark (   $api,
  $link,
  $bookmark 
)

Returns true if the given document link corresponds to the given bookmark

Parameters
API$apiThe API
DocumentLink$linkThe document link to test
string$bookmarkThe bookmark to test
Returns
true if the given document corresponds to the given bookmark

§ isBookmarkDocument()

Prismic\LinkResolver::isBookmarkDocument (   $api,
  $document,
  $bookmark 
)

Returns true if the given document corresponds to the given bookmark

Parameters
API$apiThe API
Document$documentThe document to test
string$bookmarkThe bookmark to test
Returns
true if the given document corresponds to the given bookmark

§ resolve()

Prismic\LinkResolver::resolve (   $link)
abstract

Returns the application-specific URL related to this document link, or null if the link is deemed invalid

Parameters
DocumentLink$linkThe document link
Returns
string|null

§ resolveDocument()

Prismic\LinkResolver::resolveDocument (   $document)

Returns the application-specific URL related to this Document

Parameters
Document$documentThe document
Returns
string

§ resolveLink()

Prismic\LinkResolver::resolveLink (   $link)

Returns the application-specific URL related to this document link

Parameters
DocumentLink$linkThe document link
Returns
string

The documentation for this class was generated from the following file: