Documentation · ViewHelper reference

MediaViewHelper


Render a given media file with the correct html tag.
It asks the RendererRegister for the correct Renderer class and if not found it falls
back to the ImageViewHelper as that is the "Renderer" class for images in Fluid context.

Examples

Image Object

    <f:media file="{file}" width="400" height="375" />

Output

    alt set in image record

MP4 Video Object

    <f:media file="{file}" width="400" height="375" />

Output

    

MP4 Video Object with loop and autoplay option set

    <f:media file="{file}" width="400" height="375" additionalConfig="{loop: '1', autoplay: '1'}" />

Output

    

/
  • Tag usage example

    <f:media additionalAttributes="{foo: 'bar'}" data="{foo: 'bar'}" file="[anySimpleType]" additionalConfig="{foo: 'bar'}" width="NULL" height="NULL" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL" alt="NULL">
    	<!-- tag content - may be ignored! -->
    </f:media>
  • Inline usage example

    {f:media(additionalAttributes: {foo: 'bar'}, data: {foo: 'bar'}, file: [anySimpleType], additionalConfig: {foo: 'bar'}, width: 'NULL', height: 'NULL', class: 'NULL', dir: 'NULL', id: 'NULL', lang: 'NULL', style: 'NULL', title: 'NULL', accesskey: 'NULL', tabindex: 123, onclick: 'NULL', alt: 'NULL')}

Arguments

Argument Description Type
accesskey

Keyboard shortcut to access this element

string
additionalAttributes

Additional tag attributes. They will be added directly to the resulting HTML tag.

array
additionalConfig

This array can hold additional configuration that is passed though to the Renderer object

array
alt

Specifies an alternate text for an image

string
class

CSS class(es) for this element

string
data

Additional data-* attributes. They will each be added with a "data-" prefix.

array
dir

Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)

string
file anySimpleType
height

This can be a numeric value representing the fixed height in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.

string
id

Unique (in this file) identifier for this HTML element.

string
lang

Language for this element. Use short names specified in RFC 1766

string
onclick

JavaScript evaluated for the onclick event

string
style

Individual CSS styles for this element

string
tabindex

Specifies the tab order of this element

integer
title

Tooltip text of element

string
width

This can be a numeric value representing the fixed width of in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.

string
Required attribute

Revision history