Documentation

LinkResolver
in package

The LinkResolver convert Prismic's links into your application's ones.

Since Prismic 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 RichText, or asUrl() on Link).

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 link resolving page on Prismic's API documentation to better understand the idea.

Table of Contents

__invoke()  : string|null
What happens when the link resolver gets called.
resolve()  : string|null
Returns the application-specific URL related to this document link

Methods

__invoke()

What happens when the link resolver gets called.

public __invoke(object $link) : string|null
Parameters
$link : object

The document link

Return values
string|null

The URL of the link

resolve()

Returns the application-specific URL related to this document link

public abstract resolve(object $link) : string|null
Parameters
$link : object

The document link

Return values
string|null

The URL of the link

Search results