class DocumentViewer extends AbstractDocumentViewer (View source)

Class DocumentViewer

Properties

protected null|DocumentInterface $document from AbstractDocumentViewer
protected $embedFinder from AbstractDocumentViewer
protected Packages $packages from AbstractDocumentViewer
protected RequestStack $requestStack from AbstractDocumentViewer
protected Twig_Environment $twig from AbstractDocumentViewer
protected EntityManager $entityManager from AbstractDocumentViewer
protected array $documentPlatforms from AbstractDocumentViewer

Methods

__construct(RequestStack $requestStack, Twig_Environment $environment, ObjectManager $objectManager, UrlGeneratorInterface $urlGenerator, DocumentUrlGenerator $documentUrlGenerator, Packages $packages, $availablePlatforms)

No description

string
parseSrcSet(array $options = [])

No description

string
parseSizes(array $options = [])

No description

string
getDocumentAlt()

No description

string
getTemplatesBasePath()

No description

getDocumentsByFilenames(string[] $filenames)

No description

getOneDocumentByFilenames(string[] $filenames)

No description

string
getDocumentByArray(array $options = [])

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

bool
isEmbedPlatformSupported()

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

Details

__construct(RequestStack $requestStack, Twig_Environment $environment, ObjectManager $objectManager, UrlGeneratorInterface $urlGenerator, DocumentUrlGenerator $documentUrlGenerator, Packages $packages, $availablePlatforms)

Parameters

RequestStack $requestStack
Twig_Environment $environment
ObjectManager $objectManager
UrlGeneratorInterface $urlGenerator
DocumentUrlGenerator $documentUrlGenerator
Packages $packages
$availablePlatforms

null|DocumentInterface getDocument()

Return Value

null|DocumentInterface

Packages getPackages()

Return Value

Packages

AbstractDocumentViewer setPackages(Packages $packages)

Parameters

Packages $packages

Return Value

AbstractDocumentViewer

protected string parseSrcSet(array $options = [])

Parameters

array $options

Return Value

string

protected string parseSizes(array $options = [])

Parameters

array $options sizes

Return Value

string

protected string getDocumentAlt()

Return Value

string

protected string getTemplatesBasePath()

Return Value

string

protected DocumentInterface[] getDocumentsByFilenames(string[] $filenames)

Parameters

string[] $filenames

Return Value

DocumentInterface[]

protected DocumentInterface|null getOneDocumentByFilenames(string[] $filenames)

Parameters

string[] $filenames

Return Value

DocumentInterface|null

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