|
Prismic.io PHP kit
3.0.0
|
Public Member Functions | |
| __construct ($id, $uid, $type, $tags, $slug, array $fragments, $isBroken) | |
| asHtml ($linkResolver=NULL) | |
| getUrl ($linkResolver=null) | |
| getId () | |
| getUid () | |
| asText () | |
| getType () | |
| getTags () | |
| getSlug () | |
| isBroken () | |
Public Member Functions inherited from Prismic\WithFragments | |
| __construct (array $fragments) | |
| getFragments () | |
| get ($field) | |
| has ($field) | |
| getAll ($field) | |
| getText ($field) | |
| getNumber ($field, $pattern=null) | |
| getGeoPoint ($field) | |
| getBoolean ($field) | |
| getDate ($field, $pattern=null) | |
| getTimestamp ($field) | |
| getHtml ($field, $linkResolver=null) | |
| getImage ($field) | |
| getAllImages ($field) | |
| getImageView ($field, $view=null) | |
| getAllImageViews ($field, $view) | |
| getStructuredText ($field) | |
| getLink ($field) | |
| getGroup ($field) | |
| getSliceZone ($field) | |
| getEmbed ($field) | |
| getColor ($field) | |
| asHtml ($linkResolver=null) | |
Static Public Member Functions | |
| static | parse ($json) |
Static Public Member Functions inherited from Prismic\WithFragments | |
| static | parseFragment ($json) |
| static | parseFragments ($json) |
This class embodies a document link; it is what is retrieved from the API when a link is created towards another document in the repository. Do note that in those cases, you do not retrieve all of the linked documents, but only enough information to build your link to the document. For this reason, this is also the class of the object passed in the linkResolver function. LinkInterface objects can be found in two occasions: as the "$link" variable of a HyperlinkSpan object (which happens when the link is a hyperlink in a StructuredText fragment), or the LinkInterface can also be its own fragment (e.g. for a "related" fragment, that links to a related document).
| Prismic\Fragment\Link\DocumentLink::__construct | ( | $id, | |
| $uid, | |||
| $type, | |||
| $tags, | |||
| $slug, | |||
| array | $fragments, | ||
| $isBroken | |||
| ) |
Constructs a document link.
| string | $id | the ID of the linked document |
| string | $uid | the UID of the linked document (can be null) |
| string | $type | the type of the linked document |
| array | $tags | an array of strings which are the document's tags |
| string | $slug | the current slug of the document |
| array | $fragments | the additional fragment data |
| boolean | $isBroken | returns true if the link is towards a document that is not live, for instance |
| Prismic\Fragment\Link\DocumentLink::asHtml | ( | $linkResolver = NULL | ) |
Builds an HTML version of the raw link, pointing to the right URL, and with the document's slug as the hypertext. If you want to use one of the document's fragments as the hypertext, you will need to query the document in your controller.
| \Prismic\LinkResolver | $linkResolver | the link resolver |
Implements Prismic\Fragment\FragmentInterface.
| Prismic\Fragment\Link\DocumentLink::asText | ( | ) |
Builds an unformatted text version of the raw link: simply, the document's ID.
Implements Prismic\Fragment\FragmentInterface.
| Prismic\Fragment\Link\DocumentLink::getId | ( | ) |
Returns the ID of the linked document.
| Prismic\Fragment\Link\DocumentLink::getSlug | ( | ) |
Returns the current slug of the document
| Prismic\Fragment\Link\DocumentLink::getTags | ( | ) |
Returns an array of strings which are the document's tags
| Prismic\Fragment\Link\DocumentLink::getType | ( | ) |
Returns the type of the linked document
| Prismic\Fragment\Link\DocumentLink::getUid | ( | ) |
Returns the UID of the linked document.
| Prismic\Fragment\Link\DocumentLink::getUrl | ( | $linkResolver = null | ) |
Returns the URL of the document we're linking to. The linkResolver will be needed in this case, as we're linking to a document link, which should be a URL of your website. Read more about the link resolver at the very end of prismic.io's documentation.
| \Prismic\LinkResolver | $linkResolver | the link resolver (read prismic.io's API documentation to learn more) |
Implements Prismic\Fragment\Link\LinkInterface.
| Prismic\Fragment\Link\DocumentLink::isBroken | ( | ) |
Checks if the link is broken (towards a document that is not live, for instance)
|
static |
Parses a proper bit of unmarshalled JSON into a DocumentLink object. This is used internally during the unmarshalling of API calls.
| \stdClass | $json | the raw JSON that needs to be transformed into native objects. |
1.8.12