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

Public Member Functions

 __construct ($url, $kind, $size, $filename)
 
 asHtml ($linkResolver=null)
 
 asText ()
 
 getUrl ($linkResolver=null)
 
 getKind ()
 
 getSize ()
 
 getFilename ()
 

Static Public Member Functions

static parse ($json)
 

Detailed Description

This class embodies a file link; it is what is retrieved from the API when a link is created towards a non-image 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\FileLink::__construct (   $url,
  $kind,
  $size,
  $filename 
)

Constructs a file link.

Parameters
string$urlthe URL of the resource we're linking to
string$kindthe kind of resource it is (document, image, ...)
string$sizethe size of the resource, in bytes
string$filenamethe resource's original filename, in bytes

Member Function Documentation

§ asHtml()

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

Builds an HTML version of the raw link, pointing to the right URL, and with the resource's filename 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\FileLink::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.

§ getFilename()

Prismic\Fragment\Link\FileLink::getFilename ( )

Returns the resource's original filename, in bytes

Returns
string the resource's original filename, in bytes

§ getKind()

Prismic\Fragment\Link\FileLink::getKind ( )

Returns the kind of resource it is (document, image, ...)

Returns
string the kind of resource it is (document, image, ...)

§ getSize()

Prismic\Fragment\Link\FileLink::getSize ( )

Returns the size of the resource, in bytes

Returns
string the size of the resource, in bytes

§ getUrl()

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

Returns the URL of the resource we're linking to

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

Implements Prismic\Fragment\Link\LinkInterface.

§ parse()

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

Parses a proper bit of unmarshaled JSON into a FileLink object. This is used internally during the unmarshaling of API calls.

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

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