class DocumentViewer implements ViewableInterface (View source)

Class DocumentViewer

Methods

getDocument()

No description

__construct(Document $document)

No description

Translator
getTranslator()

No description

Twig_Environment
getTwig()

No description

string
parseSrcSet(array $options = [])

No description

string
parseSizes(array $options = [])

No description

string
getDocumentByArray(array $options = [])

Output a document HTML tag according to its Mime type and the arguments array.

bool
isEmbedPlatformSupported()

No description

getEmbedFinder()

No description

string|boolean
getEmbedByArray(array $options = [])

Output an external media with an iframe according to the arguments array.

array|bool
getSourcesFiles()

Get sources files formats for audio and video documents.

array|bool
getPosterFile(array $options = [], bool $absolute = false)

No description

string
getDocumentUrlByArray(array $options = [], boolean $absolute = false)

Generate a resampled document Url.

string
getProcessedDocumentUrlByArray(array $options = [])

No description

bool|string
removeBasePath(string $path)

Need to remove base-path from url as AssetPackages will prepend it.

string
removeStartingSlash(string $path)

Remove root-slash not to disable Assets Packages resolving real server root.

Details

Document getDocument()

Return Value

Document

__construct(Document $document)

Parameters

Document $document

Translator getTranslator()

Return Value

Translator

Twig_Environment getTwig()

Return Value

Twig_Environment

protected string parseSrcSet(array $options = [])

Parameters

array $options

Return Value

string

protected string parseSizes(array $options = [])

Parameters

array $options sizes

Return Value

string

string getDocumentByArray(array $options = [])

Output a document HTML tag according to its Mime type and the arguments array.

HTML output options

  • embed (true|false), display an embed as iframe instead of its thumbnail
  • identifier
  • class
  • alt: If not filled, it will get the document name, then the document filename

Images resampling options

  • width
  • height
  • lazyload (true | false) set src in data-src
  • crop ({w}x{h}, for example : 100x200)
  • fit ({w}x{h}, for example : 100x200)
  • rotate (1-359 degrees, for example : 90)
  • grayscale (boolean)
  • quality (1-100)
  • blur (1-100)
  • sharpen (1-100)
  • contrast (1-100)
  • background (hexadecimal color without #)
  • progressive (boolean)
  • noProcess (boolean) : Disable image resample
  • inline : For SVG, display SVG code in Html instead of using

<

object> - srcset : Array [ - format: Array (same options as image) - rule ] - sizes : Array [ - "size1" - "size2" ]

Audio / Video options

  • autoplay
  • loop
  • controls
  • custom_poster

For videos, a poster can be set if you name a document after your video filename (without extension).

Parameters

array $options

Return Value

string HTML output

bool isEmbedPlatformSupported()

Return Value

bool

bool|AbstractEmbedFinder getEmbedFinder()

Return Value

bool|AbstractEmbedFinder

protected string|boolean getEmbedByArray(array $options = [])

Output an external media with an iframe according to the arguments array.

Parameters

array $options

Return Value

string|boolean

See also

\RZ\Roadiz\Utils\MediaFinders\AbstractEmbedFinder::getIFrame

protected array|bool getSourcesFiles()

Get sources files formats for audio and video documents.

This method will search for document which filename is the same except the extension. If you choose an MP4 file, it will look for a OGV and WEBM file.

Return Value

array|bool

protected array|bool getPosterFile(array $options = [], bool $absolute = false)

Parameters

array $options
bool $absolute

Return Value

array|bool

string getDocumentUrlByArray(array $options = [], boolean $absolute = false)

Generate a resampled document Url.

Generated URL will be absolute and static if a static domain name has been setup.

  • width
  • height
  • crop ({w}x{h}, for example : 100x200)
  • fit ({w}x{h}, for example : 100x200)
  • rotate (1-359 degrees, for example : 90)
  • grayscale (boolean)
  • quality (1-100) - default: 90
  • blur (1-100)
  • sharpen (1-100)
  • contrast (1-100)
  • background (hexadecimal color without #)
  • progressive (boolean)
  • noProcess (boolean) : Disable image resample

Parameters

array $options
boolean $absolute

Return Value

string Url

protected string getProcessedDocumentUrlByArray(array $options = [])

Parameters

array $options

Return Value

string

protected bool|string removeBasePath(string $path)

Need to remove base-path from url as AssetPackages will prepend it.

Parameters

string $path

Return Value

bool|string

protected string removeStartingSlash(string $path)

Remove root-slash not to disable Assets Packages resolving real server root.

Parameters

string $path

Return Value

string