Prismic.io PHP kit  3.0.0
Public Member Functions | Static Public Member Functions | List of all members
Prismic\Document Class Reference
Inheritance diagram for Prismic\Document:
Prismic\WithFragments

Public Member Functions

 __construct ($id, $uid, $type, $href, array $tags, array $slugs, array $fragments, $data)
 
 getSlug ()
 
 containsSlug ($slug)
 
 getId ()
 
 getUid ()
 
 getType ()
 
 getHref ()
 
 getTags ()
 
 getSlugs ()
 
 getData ()
 
 getFirstPublicationDate ()
 
 getLastPublicationDate ()
 
 asDocumentLink ()
 
- 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 (\stdClass $json)
 
- Static Public Member Functions inherited from Prismic\WithFragments
static parseFragment ($json)
 
static parseFragments ($json)
 

Detailed Description

Embodies a document retrieved from the API, which we'll be able to manipulate.

Constructor & Destructor Documentation

§ __construct()

Prismic\Document::__construct (   $id,
  $uid,
  $type,
  $href,
array  $tags,
array  $slugs,
array  $fragments,
  $data 
)

Constructs a Document object. To be used only for testing purposes, as this gets done during the unmarshalling

Parameters
string$idthe ID of the document
string | null$uidthe user ID of the document
string$typethe type of the document
string$hrefthe URL of the document in the repository's API
array$tagsthe tags used in the document
array$slugsthe slugs used in the document, in the past and today; today's slug is the head
json$datathe raw json retrieved from the server
array$fragmentsall the fragments in the document

Member Function Documentation

§ asDocumentLink()

Prismic\Document::asDocumentLink ( )

Convert the document to a DocumentLink

Returns
DocumentLink the newly created DocumentLink

§ containsSlug()

Prismic\Document::containsSlug (   $slug)

Checks if a given slug is a past or current slug of the document

Parameters
string$slugthe slug to check
Returns
boolean true if the slug is a past or current slug of the document, false otherwise

§ getData()

Prismic\Document::getData ( )

Returns the raw json data received from the server. Most of the time it's better to use a different helper, but it can be useful for example for newer features not yet integrated in the kit

§ getFirstPublicationDate()

Prismic\Document::getFirstPublicationDate ( )

Return the DateTime this document was first published This property will be null if the document was first published before the feature was released.

Returns
DateTime

§ getHref()

Prismic\Document::getHref ( )

Returns the URL of the document in the repository's API

Returns
string the URL of the document in the repository's API

§ getId()

Prismic\Document::getId ( )

Returns the ID of the document

Returns
string the ID of the document

§ getLastPublicationDate()

Prismic\Document::getLastPublicationDate ( )

Return the DateTime this document was last published This property will be null if the document was last published before the feature was released.

Returns
DateTime

§ getSlug()

Prismic\Document::getSlug ( )

Returns the current slug of the document

Returns
string|null the current slug of the document

§ getSlugs()

Prismic\Document::getSlugs ( )

Returns the slugs used in the document, in the past and today; today's slug is the head. Your can use getSlug() if you need just the current slug.

Returns
array the slugs used in the document, in the past and today; today's slug is the head

§ getTags()

Prismic\Document::getTags ( )

Returns the tags in the document

Returns
array the tags in the document

§ getType()

Prismic\Document::getType ( )

Returns the type of the document

Returns
string the type of the document

§ getUid()

Prismic\Document::getUid ( )

Returns the user ID of the document, a unique but human-readable identifier typically to be used in URLs.

It can be null, if the uid is not declared in the document mask.

Returns
string the ID of the document

§ parse()

static Prismic\Document::parse ( \stdClass  $json)
static

Parses a given document. Not meant to be used except for testing.

Parameters
$jsonthe json bit retrieved from the API that represents a document.
Returns
Document the manipulable object for that document.

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