Prismic.io PHP kit  3.0.0
Public Member Functions | Static Public Member Functions | List of all members
Prismic\Fragment\Link\WebLink Class Reference
Inheritance diagram for Prismic\Fragment\Link\WebLink:
Prismic\Fragment\Link\LinkInterface Prismic\Fragment\FragmentInterface

Public Member Functions

 __construct ($url, $maybeContentType=null)
 
 asHtml ($linkResolver=null)
 
 asText ()
 
 getUrl ($linkResolver=null)
 
 getContentType ()
 

Static Public Member Functions

static parse ($json)
 

Detailed Description

This class embodies a web link; it is what is retrieved from the API when a link is created towards a media file. 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).

Constructor & Destructor Documentation

§ __construct()

Prismic\Fragment\Link\WebLink::__construct (   $url,
  $maybeContentType = null 
)

Constructs a media link.

Parameters
string$urlthe URL of the resource we're linking to online
string$maybeContentTypethe content type, if known

Member Function Documentation

§ asHtml()

Prismic\Fragment\Link\WebLink::asHtml (   $linkResolver = null)

Builds an HTML version of the raw link, pointing to the right URL, and with the resource's URL as the hypertext.

Parameters
\Prismic\LinkResolver$linkResolverthe link resolver
Returns
string the HTML version of the link

Implements Prismic\Fragment\FragmentInterface.

§ asText()

Prismic\Fragment\Link\WebLink::asText ( )

Builds an unformatted text version of the raw link: simply, the URL.

Returns
string an unformatted text version of the raw link

Implements Prismic\Fragment\FragmentInterface.

§ getContentType()

Prismic\Fragment\Link\WebLink::getContentType ( )

Returns the content type, if known

Returns
string the content type, if known

§ getUrl()

Prismic\Fragment\Link\WebLink::getUrl (   $linkResolver = null)

Returns the URL of the resource we're linking to online

Parameters
\Prismic\LinkResolver$linkResolverthe link resolver (read prismic.io's API documentation to learn more)
Returns
string the URL of the resource we're linking to online

Implements Prismic\Fragment\Link\LinkInterface.

§ parse()

static Prismic\Fragment\Link\WebLink::parse (   $json)
static

Parses a proper bit of unmarshalled JSON into a WebLink object. This is used internally during the unmarshalling of API calls.

Parameters
\stdClass$jsonthe raw JSON that needs to be transformed into native objects.
Returns
WebLink the new object that was created form the JSON.

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