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

Public Member Functions

 __construct ($main, $views=array())
 
 asHtml ($linkResolver=null)
 
 asText ()
 
 getView ($key)
 
 getMain ()
 
 getViews ()
 
 getUrl ()
 
 getAlt ()
 
 getCopyright ()
 
 getWidth ()
 
 getHeight ()
 
 getLink ()
 

Detailed Description

This class embodies an Image fragment. An image in prismic.io is made of views: a main unnamed one, and optional named ones. Typically, views are different sizes of the same image ("icon", "large", ...), but not necessarily.

Constructor & Destructor Documentation

§ __construct()

Prismic\Fragment\Image::__construct (   $main,
  $views = array() 
)

Constructs an image fragment.

Parameters
\Prismic\Fragment\ImageView$mainthe main view of the image
array$viewsthe associative array of objects

Member Function Documentation

§ asHtml()

Prismic\Fragment\Image::asHtml (   $linkResolver = null)

Builds a HTML version of the Image fragment (using just the main view)

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

Implements Prismic\Fragment\FragmentInterface.

§ asText()

Prismic\Fragment\Image::asText ( )

Builds a text version of the Image fragment (simply returns its URL)

Returns
string the text version of the Image fragment

Implements Prismic\Fragment\FragmentInterface.

§ getAlt()

Prismic\Fragment\Image::getAlt ( )

Returns the alternative text of the main view.

Returns
string the image view's alternative text

§ getCopyright()

Prismic\Fragment\Image::getCopyright ( )

Returns the copyright text of the image view.

Returns
string the main view's copyright text

§ getHeight()

Prismic\Fragment\Image::getHeight ( )

Returns the height of the image view.

Returns
int the main view's height

§ getLink()

Prismic\Fragment\Image::getLink ( )

Returns the link to point to

Returns
LinkInterface the link to point to

§ getMain()

Prismic\Fragment\Image::getMain ( )

Returns the main image view

Returns
the main image view

§ getUrl()

Prismic\Fragment\Image::getUrl ( )

Returns the URL of the main view.

Returns
string the image view's URL

§ getView()

Prismic\Fragment\Image::getView (   $key)

Returns an image view from its name (for instance, "icon", "large", ...)

Parameters
string$keythe name of the view
Returns
the image view

§ getViews()

Prismic\Fragment\Image::getViews ( )

Returns an associative array of all the views for this image but the main one.

Returns
array the array of all the objects but the main one

§ getWidth()

Prismic\Fragment\Image::getWidth ( )

Returns the width of the image view.

Returns
int the main view's width

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