Fluid ViewHelper Reference 

Version

12.4

Language

en

Author

TYPO3 contributors

License

This document is published under the Creative Commons BY 4.0 license.

Rendered

Thu, 25 Dec 2025 12:30:26 +0000


This is a complete reference of all available Fluid view helpers in the TYPO3 Core.

Fluid is a PHP template engine and is the de facto standard for any HTML-based output in the TYPO3 CMS. However, it is not dependent on TYPO3 and can be used in any PHP project. See the Fluid standalone documentation.

Note: This documentation was generated from the PHP source code of TYPO3.


Table of Contents:

Global (f:*) 

Asset.css ViewHelper <f:asset.css> 

ViewHelper to add CSS to the TYPO3 AssetCollector. Either a file or inline CSS can be added.

Examples 

<f:asset.css identifier="identifier123" href="EXT:my_ext/Resources/Public/Css/foo.css" />
<f:asset.css identifier="identifier123">
   .foo { color: black; }
</f:asset.css>
Copied!

Details 

In the AssetCollector, the "identifier" attribute is used as a unique identifier. Thus, if assets are added multiple times using the same identifier, the asset will only be served once (the last added overrides previous assets).

Some available attributes are defaults but do not make sense for this ViewHelper. Relevant attributes specific for this ViewHelper are: as, crossorigin, disabled, href, hreflang, importance, integrity, media, referrerpolicy, sizes, type, nonce.

Go to the source code of this ViewHelper: Asset\CssViewHelper.php (GitHub).

Arguments

The following arguments are available for the asset.css ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

as

as
Type
string
Define the type of content being loaded (For rel="preload" or rel="prefetch" only).

class

class
Type
string
CSS class(es) for this element

crossorigin

crossorigin
Type
string
Define how to handle crossorigin requests.

data

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

dir

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

disabled

disabled
Type
bool
Define whether or not the described stylesheet should be loaded and applied to the document.

href

href
Type
string
Define the URL of the resource (absolute or relative).

hreflang

hreflang
Type
string
Define the language of the resource (Only to be used if 'href' is set).

id

id
Type
string
Unique (in this file) identifier for this HTML element.

identifier

identifier
Type
string
Required
1
Use this identifier within templates to only inject your CSS once, even though it is added multiple times.

importance

importance
Type
string
Define the relative fetch priority of the resource.

integrity

integrity
Type
string
Define base64-encoded cryptographic hash of the resource that allows browsers to verify what they fetch.

lang

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

media

media
Type
string
Define which media type the resources applies to.

nonce

nonce
Type
string
Define a cryptographic nonce (number used once) used to whitelist inline styles in a style-src Content-Security-Policy.

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

priority

priority
Type
boolean
Default
false
Define whether the CSS should be included before other CSS. CSS will always be output in the <head> tag.

referrerpolicy

referrerpolicy
Type
string
Define which referrer is sent when fetching the resource.

rel

rel
Type
string
Define the relationship of the target object to the link object.

sizes

sizes
Type
string
Define the icon size of the resource.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

type

type
Type
string
Define the MIME type (usually 'text/css').

useNonce

useNonce
Type
bool
Default
false
Whether to use the global nonce value

Asset.script ViewHelper <f:asset.script> 

ViewHelper to add JavaScript to the TYPO3 AssetCollector. Either a file or inline JavaScript can be added.

Examples 

<f:asset.script identifier="identifier123" src="EXT:my_ext/Resources/Public/JavaScript/foo.js" />
<f:asset.script identifier="identifier123">
   alert('hello world');
</f:asset.script>
Copied!

Details 

In the AssetCollector, the "identifier" attribute is used as a unique identifier. Thus, if assets are added multiple times using the same identifier, the asset will only be served once (the last added overrides previous assets).

Some available attributes are defaults but do not make sense for this ViewHelper. Relevant attributes specific for this ViewHelper are: async, crossorigin, defer, integrity, nomodule, nonce, referrerpolicy, src, type.

Go to the source code of this ViewHelper: Asset\ScriptViewHelper.php (GitHub).

Arguments

The following arguments are available for the asset.script ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

async

async
Type
bool
Define that the script will be fetched in parallel to parsing and evaluation.

class

class
Type
string
CSS class(es) for this element

crossorigin

crossorigin
Type
string
Define how to handle crossorigin requests.

data

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

defer

defer
Type
bool
Define that the script is meant to be executed after the document has been parsed.

dir

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

id

id
Type
string
Unique (in this file) identifier for this HTML element.

identifier

identifier
Type
string
Required
1
Use this identifier within templates to only inject your JS once, even though it is added multiple times.

integrity

integrity
Type
string
Define base64-encoded cryptographic hash of the resource that allows browsers to verify what they fetch.

lang

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

nomodule

nomodule
Type
bool
Define that the script should not be executed in browsers that support ES2015 modules.

nonce

nonce
Type
string
Define a cryptographic nonce (number used once) used to whitelist inline styles in a style-src Content-Security-Policy.

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

priority

priority
Type
boolean
Default
false
Define whether the JavaScript should be put in the <head> tag above-the-fold or somewhere in the body part.

referrerpolicy

referrerpolicy
Type
string
Define which referrer is sent when fetching the resource.

src

src
Type
string
Define the URI of the external resource.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

type

type
Type
string
Define the MIME type (usually 'text/javascript').

useNonce

useNonce
Type
bool
Default
false
Whether to use the global nonce value

Be.buttons.csh ViewHelper <f:be.buttons.csh> 

Deprecated

ViewHelper which returns CSH (context sensitive help) button with icon.

Examples 

Default:

<f:be.buttons.csh />
Copied!

CSH button as known from the TYPO3 backend.

Full configuration:

<f:be.buttons.csh table="xMOD_csh_corebe" field="someCshKey" />
Copied!

CSH button as known from the TYPO3 backend with some custom settings.

Full configuration with content:

<f:be.buttons.csh table="xMOD_csh_corebe" field="someCshKey">
   some text to link
</f:be.buttons.csh>
Copied!

A link with text "some text to link" to link the help.

Go to the source code of this ViewHelper: Be\Buttons\CshViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.buttons.csh ViewHelper:

field

field
Type
string
Default
''
Field name (CSH locallang main key)

table

table
Type
string
Table name ('_MOD_'+module name). If not set, the current module name will be used

wrap

wrap
Type
string
Default
''
Markup to wrap around the CSH, split by "|"

Be.labels.csh ViewHelper <f:be.labels.csh> 

Deprecated

ViewHelper which returns CSH (context sensitive help) label with icon hover.

Examples 

Default:

<f:be.labels.csh />
Copied!

CSH label as known from the TYPO3 backend.

Full configuration:

<f:be.labels.csh table="xMOD_csh_corebe" field="someCshKey" label="lang/Resources/Private/Language/locallang/header.languages" />
Copied!

CSH label as known from the TYPO3 backend with some custom settings.

Go to the source code of this ViewHelper: Be\Labels\CshViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.labels.csh ViewHelper:

field

field
Type
string
Default
''
Field name (CSH locallang main key)

label

label
Type
string
Default
''
Language label which is wrapped with the CSH

table

table
Type
string
Table name ('_MOD_'+module name). If not set, the current module name will be used

Be.menus.actionMenu ViewHelper <f:be.menus.actionMenu> 

ViewHelper which returns a select box, that can be used to switch between multiple actions and controllers and looks similar to TYPO3s funcMenu.

Examples 

Simple:

<f:be.menus.actionMenu>
   <f:be.menus.actionMenuItem label="Overview" controller="Blog" action="index" />
   <f:be.menus.actionMenuItem label="Create new Blog" controller="Blog" action="new" />
   <f:be.menus.actionMenuItem label="List Posts" controller="Post" action="index" arguments="{blog: blog}" />
</f:be.menus.actionMenu>
Copied!

Select box with the options "Overview", "Create new Blog" and "List Posts".

Localized:

<f:be.menus.actionMenu>
   <f:be.menus.actionMenuItem label="{f:translate(key:'overview')}" controller="Blog" action="index" />
   <f:be.menus.actionMenuItem label="{f:translate(key:'create_blog')}" controller="Blog" action="new" />
</f:be.menus.actionMenu>
Copied!

Localized select box.

Go to the source code of this ViewHelper: Be\Menus\ActionMenuViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.menus.actionMenu ViewHelper:

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

data

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

defaultController

defaultController
Type
string
The default controller to be used

Be.menus.actionMenuItem ViewHelper <f:be.menus.actionMenuItem> 

ViewHelper which returns an option tag. This ViewHelper only works in conjunction with \TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper . This ViewHelper is tailored to be used only in extbase context.

Examples 

Simple:

<f:be.menus.actionMenu>
   <f:be.menus.actionMenuItem label="Overview" controller="Blog" action="index" />
   <f:be.menus.actionMenuItem label="Create new Blog" controller="Blog" action="new" />
   <f:be.menus.actionMenuItem label="List Posts" controller="Post" action="index" arguments="{blog: blog}" />
</f:be.menus.actionMenu>
Copied!

Select box with the options "Overview", "Create new Blog" and "List Posts".

Localized:

<f:be.menus.actionMenu>
   <f:be.menus.actionMenuItem label="{f:translate(key='overview')}" controller="Blog" action="index" />
   <f:be.menus.actionMenuItem label="{f:translate(key='create_blog')}" controller="Blog" action="new" />
</f:be.menus.actionMenu>
Copied!

Localized select box.

Go to the source code of this ViewHelper: Be\Menus\ActionMenuItemViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.menus.actionMenuItem ViewHelper:

action

action
Type
string
Required
1
the action to be associated with this ActionMenuItem

additionalAttributes

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

arguments

arguments
Type
array
Default
array ( )
additional controller arguments to be passed to the action when this ActionMenuItem is selected

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

controller

controller
Type
string
Required
1
controller to be associated with this ActionMenuItem

data

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

label

label
Type
string
Required
1
label of the option tag

Be.menus.actionMenuItemGroup ViewHelper <f:be.menus.actionMenuItemGroup> 

ViewHelper which groups options of an option tag.

Example 

<f:be.menus.actionMenu>
    <f:be.menus.actionMenuItem label="Default: Welcome" controller="Default" action="index" />
    <f:be.menus.actionMenuItem label="Community: get in touch" controller="Community" action="index" />

    <f:be.menus.actionMenuItemGroup label="Information">
        <f:be.menus.actionMenuItem label="PHP Information" controller="Information" action="listPhpInfo" />
        <f:be.menus.actionMenuItem label="Documentation" controller="Information" action="documentation" />
        <f:be.menus.actionMenuItem label="Hooks" controller="Information" action="hooks" />
        <f:be.menus.actionMenuItem label="Signals" controller="Information" action="signals" />
        <f:be.menus.actionMenuItem label="XClasses" controller="Information" action="xclass" />
    </f:be.menus.actionMenuItemGroup>
</f:be.menus.actionMenu>
Copied!

Go to the source code of this ViewHelper: Be\Menus\ActionMenuItemGroupViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.menus.actionMenuItemGroup ViewHelper:

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

data

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

defaultController

defaultController
Type
string
Unused

label

label
Type
string
Default
''
The label of the option group

Be.security.ifAuthenticated ViewHelper <f:be.security.ifAuthenticated> 

This ViewHelper implements an ifAuthenticated/else condition for backend users and backend groups.

Examples 

Basic usage:

<f:be.security.ifAuthenticated>
   This is being shown whenever a BE user is logged in
</f:be.security.ifAuthenticated>
Copied!

Everything inside the <f:be.ifAuthenticated> tag is being displayed if the user is authenticated with any backend user account.

IfAuthenticated / then / else:

<f:be.security.ifAuthenticated>
   <f:then>
      This is being shown in case you have access.
   </f:then>
   <f:else>
      This is being displayed in case you do not have access.
   </f:else>
</f:be.security.ifAuthenticated>
Copied!

Everything inside the <f:then></f:then> is displayed the backend user is logged in. <f:else></f:else> is displayed if no backend user is logged in.

Go to the source code of this ViewHelper: Be\Security\IfAuthenticatedViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.security.ifAuthenticated ViewHelper:

else

else
Type
mixed
Value to be returned if the condition if not met.

then

then
Type
mixed
Value to be returned if the condition if met.

Be.security.ifHasRole ViewHelper <f:be.security.ifHasRole> 

This ViewHelper implements an ifHasRole/else condition for backend users and backend groups.

Role refers to backend user groups. The role attribute can either be the title of a group, or the uid.

Examples 

Basic usage:

<f:be.security.ifHasRole role="Administrator">
   This is being shown in case the current BE user belongs to a BE usergroup (aka role) titled "Administrator" (case sensitive)
</f:be.security.ifHasRole>
Copied!

Everything inside the <f:ifHasRole> tag is being displayed if the logged in backend user belongs to the specified backend group.

Using the usergroup uid as role identifier:

<f:be.security.ifHasRole role="1">
   This is being shown in case the current BE user belongs to a BE usergroup (aka role) with the uid "1"
</f:be.security.ifHasRole>
Copied!

Everything inside the <f:ifHasRole> tag is being displayed if the logged in backend user belongs to the specified backend group.

IfRole / then / else:

<f:be.security.ifHasRole role="Administrator">
   <f:then>
      This is being shown in case you have the role.
   </f:then>
   <f:else>
      This is being displayed in case you do not have the role.
   </f:else>
</f:be.security.ifHasRole>
Copied!

Everything inside the <f:then></f:then> tag is displayed if the logged in backend user belongs to the specified backend group. Otherwise, everything inside the <f:else></f:else> tag is displayed.

Go to the source code of this ViewHelper: Be\Security\IfHasRoleViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.security.ifHasRole ViewHelper:

else

else
Type
mixed
Value to be returned if the condition if not met.

role

role
Type
string
The usergroup (either the usergroup uid or its title).

then

then
Type
mixed
Value to be returned if the condition if met.

Be.infobox ViewHelper <f:be.infobox> 

ViewHelper for rendering a styled content infobox markup.

States 

The Infobox provides different context sensitive states that can be used to provide an additional visual feedback to the to the user to underline the meaning of the information.

Possible values are in range from -2 to 2. Please choose a meaningful value from the following list.

-2
Notices (Default)
-1
Information
0
Positive feedback
1
Warnings
2
Error

Examples 

Simple:

<f:be.infobox title="Message title">your box content</f:be.infobox>
Copied!

All options:

<f:be.infobox title="Message title" message="your box content" state="-2" iconName="check" disableIcon="true" />
Copied!

Go to the source code of this ViewHelper: Be\InfoboxViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.infobox ViewHelper:

disableIcon

disableIcon
Type
bool
Default
false
If set to TRUE, the icon is not rendered.

iconName

iconName
Type
string
The icon name from font awesome, NULL sets default icon

message

message
Type
string
The message of the info box, if NULL tag content is used

state

state
Type
int
Default
-2
The state of the box, InfoboxViewHelper::STATE_*

title

title
Type
string
The title of the info box

Be.pageInfo ViewHelper <f:be.pageInfo> 

ViewHelper which return page info icon as known from TYPO3 backend modules.

Examples 

Default:

<f:be.pageInfo />
Copied!

Page info icon with context menu

Go to the source code of this ViewHelper: Be\PageInfoViewHelper.php (GitHub).

Be.pagePath ViewHelper <f:be.pagePath> 

ViewHelper which returns the current page path as known from TYPO3 backend modules.

Examples 

Default:

<f:be.pagePath />
Copied!

Current page path, prefixed with "Path:" and wrapped in a span with the class typo3-docheader-pagePath.

Go to the source code of this ViewHelper: Be\PagePathViewHelper.php (GitHub).

Be.pageRenderer ViewHelper <f:be.pageRenderer> 

ViewHelper to register backend module resources like CSS and JavaScript using the PageRenderer.

Examples 

All options:

<f:be.pageRenderer
    pageTitle="foo"
    includeCssFiles="{0: 'EXT:my_ext/Resources/Public/Css/Stylesheet.css'}"
    includeJsFiles="{0: 'EXT:my_ext/Resources/Public/JavaScript/Library1.js', 1: 'EXT:my_ext/Resources/Public/JavaScript/Library2.js'}"
    addJsInlineLabels="{'my_ext.label1': 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:label1'}"
    includeJavaScriptModules="{0: '@my-vendor/my-ext/my-module.js'}"
    includeRequireJsModules="{0: 'EXT:my_ext/Resources/Public/JavaScript/RequireJsModule'}"
    addInlineSettings="{'some.setting.key': 'some.setting.value'}"
/>
Copied!

This will load the specified css, js files and requireJs modules, adds a custom js inline setting, and adds a resolved label to be used in js.

Go to the source code of this ViewHelper: Be\PageRendererViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.pageRenderer ViewHelper:

addInlineSettings

addInlineSettings
Type
array
Adds Javascript Inline Setting

addJsInlineLabels

addJsInlineLabels
Type
array
Custom labels to add to JavaScript inline labels

includeCssFiles

includeCssFiles
Type
array
List of custom CSS file to be loaded

includeJavaScriptModules

includeJavaScriptModules
Type
array
List of JavaScript modules to be loaded

includeJsFiles

includeJsFiles
Type
array
List of custom JavaScript file to be loaded

includeRequireJsModules

includeRequireJsModules
Type
array
List of RequireJS modules to be loaded

pageTitle

pageTitle
Type
string
Default
''
title tag of the module. Not required by default, as BE modules are shown in a frame

Be.tableList ViewHelper <f:be.tableList> 

ViewHelper which renders a record list as known from the TYPO3 list module.

Examples 

Minimal:

<f:be.tableList tableName="fe_users" />
Copied!

List of all "Website user" records stored in the configured storage PID. Records will be editable, if the current backend user has got edit rights for the table fe_users.

Only the title column (username) will be shown.

Context menu is active.

Full:

<f:be.tableList tableName="fe_users" fieldList="{0: 'name', 1: 'email'}"
    storagePid="1"
    levels="2"
    filter="foo"
    recordsPerPage="10"
    sortField="name"
    sortDescending="true"
    readOnly="true"
    enableClickMenu="false"
    enableControlPanels="true"
    clickTitleMode="info"
    />
Copied!

List of "Website user" records with a text property of foo stored on PID 1 and two levels down. Clicking on a username will open the TYPO3 info popup for the respective record

Go to the source code of this ViewHelper: Be\TableListViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.tableList ViewHelper:

clickTitleMode

clickTitleMode
Type
string
Default
''
one of "edit", "show" (only pages, tt_content), "info

enableClickMenu

enableClickMenu
Type
bool
Default
true
enables context menu

enableControlPanels

enableControlPanels
Type
bool
Default
false
enables control panels

fieldList

fieldList
Type
array
Default
array ( )
list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown

filter

filter
Type
string
Default
''
corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched

levels

levels
Type
int
Default
0
corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched

readOnly

readOnly
Type
bool
Default
false
if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table!

recordsPerPage

recordsPerPage
Type
int
Default
0
amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100

sortDescending

sortDescending
Type
bool
Default
false
if TRUE records will be sorted in descending order

sortField

sortField
Type
string
Default
''
table field to sort the results by

storagePid

storagePid
Type
int
by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten

tableName

tableName
Type
string
Required
1
name of the database table

Be.uri ViewHelper <f:be.uri> 

A ViewHelper for creating URIs to modules.

Examples 

URI to the web_ts module on page 92:

<f:be.uri route="web_ts" parameters="{id: 92}"/>
Copied!

/typo3/module/web/ts?token=b6e9c9f&id=92

Inline notation:

{f:be.uri(route: 'web_ts', parameters: '{id: 92}')}
Copied!

/typo3/module/web/ts?token=b6e9c9f&id=92

Go to the source code of this ViewHelper: Be\UriViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.uri ViewHelper:

parameters

parameters
Type
array
Default
array ( )
An array of parameters

referenceType

referenceType
Type
string
Default
'absolute'
The type of reference to be generated (one of the constants)

route

route
Type
string
Required
1
The name of the route

Cache.disable ViewHelper <f:cache.disable> 

ViewHelper to disable template compiling

Inserting this ViewHelper at any point in the template, including inside conditions which do not get rendered, will forcibly disable the caching/compiling of the full template file to a PHP class.

Use this if for whatever reason your platform is unable to create or load PHP classes (for example on read-only file systems or when using an incompatible default cache backend).

Passes through anything you place inside the ViewHelper, so can safely be used as container tag, as self-closing or with inline syntax - all with the same result.

Examples 

Self-closing 

<f:cache.disable />
Copied!

Inline mode 

{f:cache.disable()}

Copied!

Container tag 

<f:cache.disable>
   Some output or Fluid code
</f:cache.disable>
Copied!

Additional output is also not compilable because of the ViewHelper

Go to the source code of this ViewHelper: Cache\DisableViewHelper.php (GitHub).

Cache.static ViewHelper <f:cache.static> 

ViewHelper to force compiling to a static string

Used around chunks of template code where you want the output of said template code to be compiled to a static string (rather than a collection of compiled nodes, as is the usual behavior).

The effect is that none of the child ViewHelpers or nodes used inside this tag will be evaluated when rendering the template once it is compiled. It will essentially replace all logic inside the tag with a plain string output.

Works by turning the compile method into a method that renders the child nodes and returns the resulting content directly as a string variable.

You can use this with great effect to further optimise the performance of your templates: in use cases where chunks of template code depend on static variables (like thoese in {settings} for example) and those variables never change, and the template uses no other dynamic variables, forcing the template to compile that chunk to a static string can save a lot of operations when rendering the compiled template.

NB: NOT TO BE USED FOR CACHING ANYTHING OTHER THAN STRING- COMPATIBLE OUTPUT!

USE WITH CARE! WILL PRESERVE EVERYTHING RENDERED, INCLUDING POTENTIALLY SENSITIVE DATA CONTAINED IN OUTPUT!

Examples 

Usage and effect 

<f:if condition="{var}">Is always evaluated also when compiled</f:if>
<f:cache.static>
    <f:if condition="{othervar}">
        Will only be evaluated once and this output will be
        cached as a static string with no logic attached.
        The compiled template will not contain neither the
        condition ViewHelperNodes or the variable accessor
        that are used inside this node.
    </f:if>
</f:cache.static>
Copied!

This is also evaluated when compiled (static node is closed):

<f:if condition="{var}">Also evaluated; is outside static node</f:if>
Copied!

Go to the source code of this ViewHelper: Cache\StaticViewHelper.php (GitHub).

Cache.warmup ViewHelper <f:cache.warmup> 

ViewHelper to insert variables which only apply during cache warmup and only apply if no other variables are specified for the warmup process.

If a chunk of template code is impossible to compile without additional variables, for example when rendering sections or partials using dynamic names, you can use this ViewHelper around that chunk and specify a set of variables which will be assigned only while compiling the template and only when this is done as part of cache warmup. The template chunk can then be compiled using those default variables.

This does not imply that only those variable values will be used by the compiled template. It only means that DEFAULT values of vital variables will be present during compiling.

If you find yourself completely unable to properly warm up a specific template file even with use of this ViewHelper, then you can consider using f:cache.disable ViewHelper to prevent the template compiler from even attempting to compile it.

USE WITH CARE! SOME EDGE CASES OF FOR EXAMPLE VIEWHELPERS WHICH REQUIRE SPECIAL VARIABLE TYPES MAY NOT BE SUPPORTED HERE DUE TO THE RUDIMENTARY NATURE OF VARIABLES YOU DEFINE.

Examples 

Usage and effect 

<f:cache.warmup variables="{foo: bar}">
   Template code depending on {foo} variable which is not
   assigned when warming up Fluid's caches. {foo} is only
   assigned if the variable does not already exist and the
   assignment only happens if Fluid is in warmup mode.
</f:cache.warmup>
Copied!

Go to the source code of this ViewHelper: Cache\WarmupViewHelper.php (GitHub).

Arguments

The following arguments are available for the cache.warmup ViewHelper:

variables

variables
Type
array
Default
array ( )
Array of variables to assign ONLY when compiling. See main class documentation.

Debug.render ViewHelper <f:debug.render> 

Debuggable version of f:render - performs the same rendering operation but wraps the output with HTML that can be inspected with the admin panel in frontend.

Replaces f:render when the admin panel decides (see ViewHelperResolver class). Also possible to use explicitly by using f:debug.render instead of the normal f:render statement.

Go to the source code of this ViewHelper: Debug\RenderViewHelper.php (GitHub).

Arguments

The following arguments are available for the debug.render ViewHelper:

arguments

arguments
Type
array
Default
array ( )
Array of variables to be transferred. Use {_all} for all variables

contentAs

contentAs
Type
string
If used, renders the child content and adds it as a template variable with this name for use in the partial/section

debug

debug
Type
boolean
Default
true
If true, the admin panel shows debug information if activated,

default

default
Type
mixed
Value (usually string) to be displayed if the section or partial does not exist

optional

optional
Type
boolean
Default
false
If TRUE, considers the *section* optional. Partial never is.

partial

partial
Type
string
Partial to render, with or without section

section

section
Type
string
Section to render - combine with partial to render section in partial

Form ViewHelper <f:form> 

Form ViewHelper. Generates a <form> Tag. Tailored for extbase plugins, uses extbase Request.

Go to the source code of this ViewHelper: FormViewHelper.php (GitHub).

Array parameter passed to Extbase controller action 

For example a very simplified search form could look like this:

packages/my_extension/Resources/Private/Templates/Search/SearchForm.html
<f:form action="search" method="post" pageUid="{settings.targetPid}">
    <div>
        <label for="sword">Search:</label>
        <f:form.textfield name="search[sword]" value="{sword}" id="sword" />
    </div>
    <div>
        <f:form.submit name="search[submitButton]" value="Submit" />
    </div>
</f:form>
Copied!

The Extbase controller action could for example look like this:

packages/my_extension/Classes/Controller/SearchController.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class SearchController extends ActionController
{
    public function searchAction(array $search = []): ResponseInterface
    {
        // TODO: implement search
        return $this->htmlResponse();
    }
}
Copied!

Property mapping - using the form with a model 

In most cases you will use the f:form ViewHelper with Extbase models or data objects.

For example, user could add a comment in such a form:

packages/my_extension/Resources/Private/Templates/Comment/_CommentForm.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      data-namespace-typo3-fluid="true">
    <f:form action="create" controller="Comment" objectName="comment" object="{newComment}" method="post">
        <div>
                <label for="tx-blogexample-email">E-Mail::</label>
                <f:form.textfield property="email" type="email" id="tx-blogexample-email"/>
        </div>
        <div>
                <label for="tx-blogexample-content">Message:</label>
                <f:form.textarea property="content" id="tx-blogexample-content" rows="8" cols="46"/>
        </div>
        <div>
                <f:form.submit class="button" value="Submit"/>
        </div>
    </f:form>
</html>
Copied!

The Extbase Controller action displaying the form then creates the Domain object and passes it to the view. In the Fluid template above we use argument object to pass any data the object might already contain to the ViewHelper.

By using the argument "property" on the form input elements the properties of the model are automatically bound to the input elements.

The controller could look like this:

packages/my_extension/Classes/Controller/CommentController.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

use Psr\Http\Message\ResponseInterface;
use T3docs\BlogExample\Domain\Model\Comment;
use T3docs\BlogExample\Domain\Repository\CommentRepository;
use TYPO3\CMS\Extbase\Annotation\IgnoreValidation;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class CommentController extends ActionController
{
    public function __construct(
        protected readonly CommentRepository $commentRepository,
    ) {}

    #[IgnoreValidation(['argumentName' => 'newComment'])]
    public function commentFormAction(?Comment $newComment = null): ResponseInterface
    {
        if ($newComment === null) {
            $newComment = new Comment();
            $newComment->setDate(new \DateTime());
        }
        // The assigned object will be used in argument object
        $this->view->assign('newComment', $newComment);
        return $this->htmlResponse();
    }

    public function createAction(
        // This parameter must have the same name as argument `objectName` of f:form
        Comment $comment,
    ): ResponseInterface {
        $this->commentRepository->add($comment);
        $this->addFlashMessage('Comment was saved');
        return $this->redirect('show');
    }
}
Copied!

If the model is not valid (see Validation) Extbase will automatically refer the request back to the referring action (here commentFormAction()). By passing the object with the non-validated object to the view again, the user can see their faulty inputs and correct them instead of seeing an empty form.

Security in Fluid forms 

Fluid automatically adds several hidden field to forms:

  • __referrer[] with an array of items @extension, @controller, @action, arguments and @request. This holds information about where the form has been created, so that in case of errors, redirection to the originating Extbase controller and action (and extension) is possible.
  • __trustedProperties (string) holds information about all used properties of all Extbase domain models that have been utilized within the related <f:form> context. This is used to ensure only properties will be evaluated for persistence that have an editable form field associated with them.

To prevent tampering with this vital data, the important fields (__referrer[arguments], __referrer[@request], __trustedProperties) are signed with the private TYPO3 encryption key using an HMAC hash.

An example would look like this:

Example HTML rendered after Fluid processing
<form action="/admin/update?token=328190ab378fe49af07d8b6b4ec31f87bd910efc" method="post">
  <div>
    <input type="hidden" name="__referrer[@extension]" value="Beuser">
    <input type="hidden" name="__referrer[@controller]" value="BackendUser">
    <input type="hidden" name="__referrer[@action]" value="list">
    <input type="hidden" name="__referrer[arguments]" value="YTozOntzOjEwOiJjb250cm9sbGVyIjtzOjExOiJCYWNrZW5kVXNlciI7czo2OiJhY3Rpb24iO3M6NToiaW5kZXgiO3M6NToidG9rZW4iO3M6NDA6IjgxNWZhOGI0OGYyZDg0N2NkMzcwYWIzYTkyMjhlNDY2OWI4OTI0MmUiO30=b305f0773528375502f167cde7c6c63f6ba988f9">
    <input type="hidden" name="__referrer[@request]" value="{&quot;@extension&quot;:&quot;Beuser&quot;,&quot;@controller&quot;:&quot;BackendUser&quot;,&quot;@action&quot;:&quot;list&quot;}51b024523b594011fa9054f7fc82c03ead78061b">
    <input type="hidden" name="__trustedProperties" value="{&quot;demand&quot;:{&quot;userName&quot;:1,&quot;userType&quot;:1,&quot;status&quot;:1,&quot;logins&quot;:1,&quot;backendUserGroup&quot;:1},&quot;operation&quot;:1}c25fc9eb44fc0e40e8ec5cf39fc5d21022172ebf">
  </div>
</form>
Copied!

If form fields are added or removed via attacks, Extbase detects the mismatch and blocks further processing.

Form fields can be grouped in an array for efficient processing. An internal Extbase processing action maps the received data to a model, where (optional and configurable) validation occurs. Only valid data is passed on to the action and stored in the database.

Arguments of the form ViewHelper 

absolute

absolute
Type
bool
Default
false
If set, an absolute action URI is rendered (only active if $actionUri is not set)

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

action

action
Type
string
Target action

actionUri

actionUri
Type
string
can be used to overwrite the "action" attribute of the form tag

addQueryString

addQueryString
Type
string
Default
false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.

additionalAttributes

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

additionalParams

additionalParams
Type
array
Default
array ( )
additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set)

arguments

arguments
Type
array
Default
array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)

argumentsToBeExcludedFromQueryString

argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

controller

controller
Type
string
Target controller

data

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

dir

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

enctype

enctype
Type
string
MIME type with which the form is submitted

extensionName

extensionName
Type
string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used

fieldNamePrefix

fieldNamePrefix
Type
string
Prefix that will be added to all field names within this form. If not set the prefix will be tx_yourExtension_plugin

format

format
Type
string
Default
''
The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)

hiddenFieldClassName

hiddenFieldClassName
Type
string
hiddenFieldClassName

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

method

method
Type
string
Default
'post'
Transfer type (get or post)

name

name
Type
string
Name of form

noCache

noCache
Type
bool
Default
false
set this to disable caching for the target page. You should not need this.

novalidate

novalidate
Type
bool
Indicate that the form is not to be validated on submit.

object

object
Type
mixed
Object to use for the form. Use in conjunction with the "property" attribute on the sub tags

objectName

objectName
Type
string
name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

onreset

onreset
Type
string
JavaScript: On reset of the form

onsubmit

onsubmit
Type
string
JavaScript: On submit of the form

pageType

pageType
Type
int
Default
0
Target page type

pageUid

pageUid
Type
int
Target page uid

pluginName

pluginName
Type
string
Target plugin. If empty, the current plugin name is used

requestToken

requestToken
Type
mixed
whether to add that request token to the form

section

section
Type
string
Default
''
The anchor to be added to the action URI (only active if $actionUri is not set)

signingType

signingType
Type
string
which signing type to be used on the request token (falls back to "nonce")

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

target

target
Type
string
Target attribute of the form

title

title
Type
string
Tooltip text of element

ViewHelpers for form input elements 

Form.select.optgroup ViewHelper <f:form.select.optgroup> 

Adds custom <optgroup> tags inside an <f:form.select>, supports further child <f:form.select.option> tags.

Go to the source code of this ViewHelper: Form\Select\OptgroupViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.select.optgroup ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
boolean
Default
false
If true, option group is rendered as disabled

id

id
Type
string
Unique (in this file) identifier for this HTML element.

label

label
Type
string
Human-readable label property for the generated optgroup tag

lang

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

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

Form.select.option ViewHelper <f:form.select.option> 

Adds custom <option> tags inside an <f:form.select>.

Go to the source code of this ViewHelper: Form\Select\OptionViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.select.option ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

selected

selected
Type
boolean
If set, overrides automatic detection of selected state for this option.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value to be inserted in HTML tag - must be convertible to string!

Form.button ViewHelper <f:form.button> 

Creates a button.

Examples 

Defaults:

<f:form.button>Send Mail</f:form.button>
Copied!

Output:

<button type="submit" name="" value="">Send Mail</button>
Copied!

Disabled cancel button with some HTML5 attributes:

<f:form.button type="reset" disabled="disabled"
    name="buttonName" value="buttonValue"
    formmethod="post" formnovalidate="formnovalidate"
>
    Cancel
</f:form.button>
Copied!

Output:

<button disabled="disabled" formmethod="post" formnovalidate="formnovalidate" type="reset" name="myForm[buttonName]" value="buttonValue">Cancel</button>
Copied!

Go to the source code of this ViewHelper: Form\ButtonViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.button ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

autofocus

autofocus
Type
string
Specifies that a button should automatically get focus when the page loads

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

form

form
Type
string
Specifies one or more forms the button belongs to

formaction

formaction
Type
string
Specifies where to send the form-data when a form is submitted. Only for type="submit"

formenctype

formenctype
Type
string
Specifies how form-data should be encoded before sending it to a server. Only for type="submit" (e.g. "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain")

formmethod

formmethod
Type
string
Specifies how to send the form-data (which HTTP method to use). Only for type="submit" (e.g. "get" or "post")

formnovalidate

formnovalidate
Type
string
Specifies that the form-data should not be validated on submission. Only for type="submit"

formtarget

formtarget
Type
string
Specifies where to display the response after submitting the form. Only for type="submit" (e.g. "_blank", "_self", "_parent", "_top", "framename")

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

type

type
Type
string
Default
'submit'
Specifies the type of button (e.g. "button", "reset" or "submit")

value

value
Type
mixed
Value of input tag

Form.checkbox ViewHelper <f:form.checkbox> 

ViewHelper which creates a simple checkbox <input type="checkbox">.

Examples 

Simple one 

<f:form.checkbox name="myCheckBox" value="someValue" />
Copied!

Output:

<input type="checkbox" name="myCheckBox" value="someValue" />
Copied!

Preselect 

<f:form.checkbox name="myCheckBox" value="someValue" checked="{object.value} == 5" />
Copied!

Output:

<input type="checkbox" name="myCheckBox" value="someValue" checked="checked" />
Copied!

Depending on bound object to surrounding f:form.

Bind to object property 

<f:form.checkbox property="interests" value="TYPO3" multiple="1" />
Copied!

Output:

<input type="checkbox" name="user[interests][]" value="TYPO3" checked="checked" />
Copied!

Depending on property interests.

Go to the source code of this ViewHelper: Form\CheckboxViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.checkbox ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

checked

checked
Type
bool
Specifies that the input element should be preselected

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

multiple

multiple
Type
bool
Default
false
Specifies whether this checkbox belongs to a multivalue (is part of a checkbox group)

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
string
Required
1
Value of input tag. Required for checkboxes

Form.countrySelect ViewHelper <f:form.countrySelect> 

Renders a <select> tag with all available countries as options.

Examples 

Basic usage 

<f:form.countrySelect name="country" value="{defaultCountry}" />
Copied!

Output:

<select name="country">
  <option value="BE">Belgium</option>
  <option value="FR">France</option>
  ....
</select>
Copied!

Prioritize countries 

Define a list of countries which should be listed as first options in the form element:

  <f:form.countrySelect
    name="country"
    value="AT"
    prioritizedCountries="{0: 'DE', 1: 'AT', 2: 'CH'}"
  />

Additionally, Austria is pre-selected.
Copied!

Display another language 

A combination of optionLabelField and alternativeLanguage is possible. For instance, if you want to show the localized official names but not in your default language but in French. You can achieve this by using the following combination:

<f:form.countrySelect
  name="country"
  optionLabelField="localizedOfficialName"
  alternativeLanguage="fr"
  sortByOptionLabel="true"
/>
Copied!

Bind an object 

You can also use the "property" attribute if you have bound an object to the form. See <f:form> for more documentation.

Go to the source code of this ViewHelper: Form\CountrySelectViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.countrySelect ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

alternativeLanguage

alternativeLanguage
Type
string
If specified, the country list will be shown in the given language.

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

excludeCountries

excludeCountries
Type
array
Default
array ( )
Array with country codes that should not be shown.

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

multiple

multiple
Type
boolean
Default
false
If set multiple options may be selected.

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

onlyCountries

onlyCountries
Type
array
Default
array ( )
If set, only the country codes in the list are rendered.

optionLabelField

optionLabelField
Type
string
Default
'localizedName'
If specified, will call the appropriate getter on each object to determine the label. Use "name", "localizedName", "officialName" or "localizedOfficialName"

prependOptionLabel

prependOptionLabel
Type
string
If specified, will provide an option at first position with the specified label.

prependOptionValue

prependOptionValue
Type
string
If specified, will provide an option at first position with the specified value.

prioritizedCountries

prioritizedCountries
Type
array
Default
array ( )
A list of country codes which should be listed on top of the list.

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

required

required
Type
boolean
Default
false
If set no empty value is allowed.

size

size
Type
string
Size of select field, a numeric value to show the amount of items to be visible at the same time - equivalent to HTML <select> site attribute

sortByOptionLabel

sortByOptionLabel
Type
boolean
Default
false
If true, List will be sorted by label.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.hidden ViewHelper <f:form.hidden> 

Renders an <input type="hidden" ...> tag.

Examples 

Example:

<f:form.hidden name="myHiddenValue" value="42" />
Copied!

Output:

<input type="hidden" name="myHiddenValue" value="42" />
Copied!

You can also use the "property" attribute if you have bound an object to the form. See <f:form> for more documentation.

Go to the source code of this ViewHelper: Form\HiddenViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.hidden ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

respectSubmittedDataValue

respectSubmittedDataValue
Type
bool
Default
true
enable or disable the usage of the submitted values

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.password ViewHelper <f:form.password> 

ViewHelper which creates a simple Password Text Box <input type="password">.

Examples 

Example:

<f:form.password name="myPassword" />
Copied!

Output:

<input type="password" name="myPassword" value="" />
Copied!

Go to the source code of this ViewHelper: Form\PasswordViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.password ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

autocomplete

autocomplete
Type
string
Specify the autocomplete behaviour for password managers

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the password field should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

maxlength

maxlength
Type
int
The maxlength attribute of the password field (will not be validated)

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

placeholder

placeholder
Type
string
The placeholder of the password field

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

readonly

readonly
Type
string
The readonly attribute of the password field

size

size
Type
int
The size of the password field

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.radio ViewHelper <f:form.radio> 

ViewHelper which creates a simple radio button <input type="radio">.

Examples 

Simple 

<f:form.radio name="myRadioButton" value="someValue" />
Copied!

Output:

<input type="radio" name="myRadioButton" value="someValue" />
Copied!

Preselect 

<f:form.radio name="myRadioButton" value="someValue" checked="{object.value} == 5" />
Copied!

Output:

<input type="radio" name="myRadioButton" value="someValue" checked="checked" />
Copied!

Depending on bound object to surrounding f:form.

Bind to object property 

<f:form.radio property="newsletter" value="1" /> yes
<f:form.radio property="newsletter" value="0" /> no
Copied!

Output:

<input type="radio" name="user[newsletter]" value="1" checked="checked" /> yes
<input type="radio" name="user[newsletter]" value="0" /> no
Copied!

Depending on property newsletter.

Go to the source code of this ViewHelper: Form\RadioViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.radio ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

checked

checked
Type
bool
Specifies that the input element should be preselected

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
string
Required
1
Value of input tag. Required for radio buttons

Form.select ViewHelper <f:form.select> 

This ViewHelper generates a <select> dropdown list for the use with a form.

Basic usage 

The most straightforward way is to supply an associative array as the options parameter. The array key is used as option key, and the value is used as human-readable name.

Basic usage:

<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" />
Copied!

Pre select a value 

To pre select a value, set value to the option key which should be selected. Default value:

<f:form.select name="paymentOptions" options="{payPal: 'PayPal International Services', visa: 'VISA Card'}" value="visa" />
Copied!

Generates a dropdown box like above, except that "VISA Card" is selected.

If the select box is a multi-select box multiple="1", then "value" can be an array as well.

Custom options and option group rendering 

Child nodes can be used to create a completely custom set of <option> and <optgroup> tags in a way compatible with the HMAC generation. To do so, leave out the options argument and use child ViewHelpers:

Custom options and optgroup:

<f:form.select name="myproperty">
   <f:form.select.option value="1">Option one</f:form.select.option>
   <f:form.select.option value="2">Option two</f:form.select.option>
   <f:form.select.optgroup>
      <f:form.select.option value="3">Grouped option one</f:form.select.option>
      <f:form.select.option value="4">Grouped option twi</f:form.select.option>
   </f:form.select.optgroup>
</f:form.select>
Copied!

Usage on domain objects 

If you want to output domain objects, you can just pass them as array into the options parameter. To define what domain object value should be used as option key, use the optionValueField variable. Same goes for optionLabelField. If neither is given, the Identifier (UID/uid) and the __toString() method are tried as fallbacks.

If the optionValueField variable is set, the getter named after that value is used to retrieve the option key. If the optionLabelField variable is set, the getter named after that value is used to retrieve the option value.

If the prependOptionLabel variable is set, an option item is added in first position, bearing an empty string or - if provided, the value of the prependOptionValue variable as value.

Domain objects:

<f:form.select name="users" options="{userArray}" optionValueField="id" optionLabelField="firstName" />
Copied!

In the above example, the userArray is an array of "User" domain objects, with no array key specified.

So, in the above example, the method $user->getId() is called to retrieve the key, and $user->getFirstName() to retrieve the displayed value of each entry.

The value property now expects a domain object, and tests for object equivalence.

Go to the source code of this ViewHelper: Form\SelectViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.select ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

multiple

multiple
Type
boolean
Default
false
If set multiple options may be selected.

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

optionLabelField

optionLabelField
Type
string
If specified, will call the appropriate getter on each object to determine the label.

optionValueField

optionValueField
Type
string
If specified, will call the appropriate getter on each object to determine the value.

options

options
Type
array
Associative array with internal IDs as key, and the values are displayed in the select box. Can be combined with or replaced by child f:form.select.* nodes.

optionsAfterContent

optionsAfterContent
Type
boolean
Default
false
If true, places auto-generated option tags after those rendered in the tag content. If false, automatic options come first.

prependOptionLabel

prependOptionLabel
Type
string
If specified, will provide an option at first position with the specified label.

prependOptionValue

prependOptionValue
Type
string
If specified, will provide an option at first position with the specified value.

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

required

required
Type
boolean
Default
false
If set no empty value is allowed.

selectAllByDefault

selectAllByDefault
Type
boolean
Default
false
If specified options are selected if none was set before.

size

size
Type
string
Size of select field, a numeric value to show the amount of items to be visible at the same time - equivalent to HTML <select> site attribute

sortByOptionLabel

sortByOptionLabel
Type
boolean
Default
false
If true, List will be sorted by label.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.submit ViewHelper <f:form.submit> 

Creates a submit button.

Examples 

Defaults 

<f:form.submit value="Send Mail" />
Copied!

Output:

<input type="submit" />
Copied!

Dummy content for template preview 

<f:form.submit name="mySubmit" value="Send Mail"><button>dummy button</button></f:form.submit>
Copied!

Output:

<input type="submit" name="mySubmit" value="Send Mail" />
Copied!

Go to the source code of this ViewHelper: Form\SubmitViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.submit ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.textarea ViewHelper <f:form.textarea> 

Generates an <textarea>.

The value of the text area needs to be set via the value attribute, as with all other form ViewHelpers.

Examples 

Example:

<f:form.textarea name="myTextArea" value="This is shown inside the textarea" />
Copied!

Output:

<textarea name="myTextArea">This is shown inside the textarea</textarea>
Copied!

Go to the source code of this ViewHelper: Form\TextareaViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.textarea ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

autofocus

autofocus
Type
string
Specifies that a text area should automatically get focus when the page loads

class

class
Type
string
CSS class(es) for this element

cols

cols
Type
int
The number of columns of a text area

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

placeholder

placeholder
Type
string
The placeholder of the textarea

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

readonly

readonly
Type
string
The readonly attribute of the textarea

required

required
Type
bool
Default
false
Specifies whether the textarea is required

rows

rows
Type
int
The number of rows of a text area

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.textfield ViewHelper <f:form.textfield> 

ViewHelper which creates a text field <input type="text">.

Examples 

Example:

<f:form.textfield name="myTextBox" value="default value" />
Copied!

Output:

<input type="text" name="myTextBox" value="default value" />
Copied!

Go to the source code of this ViewHelper: Form\TextfieldViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.textfield ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

autofocus

autofocus
Type
string
Specifies that an input should automatically get focus when the page loads

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

maxlength

maxlength
Type
int
The maxlength attribute of the input field (will not be validated)

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

pattern

pattern
Type
string
HTML5 validation pattern

placeholder

placeholder
Type
string
The placeholder of the textfield

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

readonly

readonly
Type
string
The readonly attribute of the input field

required

required
Type
bool
Default
false
If the field is required or not

size

size
Type
int
The size of the input field

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

type

type
Type
string
Default
'text'
The field type, e.g. "text", "email", "url" etc.

value

value
Type
mixed
Value of input tag

Form.upload ViewHelper <f:form.upload> 

A ViewHelper which generates an <input type="file"> HTML element. Make sure to set enctype="multipart/form-data" on the form!

Examples 

Example:

<f:form.upload name="file" />
Copied!

Output:

<input type="file" name="file" />
Copied!

Go to the source code of this ViewHelper: Form\UploadViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.upload ViewHelper:

accept

accept
Type
string
Specifies the allowed file extensions to upload via comma-separated list, example ".png,.gif"

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

multiple

multiple
Type
string
Specifies that the file input element should allow multiple selection of files

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.validationResults ViewHelper <f:form.validationResults> 

Validation results ViewHelper

Examples 

Output error messages as a list:

<f:form.validationResults>
   <f:if condition="{validationResults.flattenedErrors}">
      <ul class="errors">
         <f:for each="{validationResults.flattenedErrors}" as="errors" key="propertyPath">
            <li>{propertyPath}
               <ul>
                  <f:for each="{errors}" as="error">
                     <li>{error.code}: {error}</li>
                  </f:for>
               </ul>
            </li>
         </f:for>
      </ul>
   </f:if>
</f:form.validationResults>
Copied!

Output:

<ul class="errors">
   <li>1234567890: Validation errors for argument "newBlog"</li>
</ul>
Copied!

Output error messages for a single property:

<f:form.validationResults for="someProperty">
   <f:if condition="{validationResults.flattenedErrors}">
      <ul class="errors">
         <f:for each="{validationResults.errors}" as="error">
            <li>{error.code}: {error}</li>
         </f:for>
      </ul>
   </f:if>
</f:form.validationResults>
Copied!

Output:

<ul class="errors">
  <li>1234567890: Some error message</li>
</ul>
Copied!

Go to the source code of this ViewHelper: Form\ValidationResultsViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.validationResults ViewHelper:

as

as
Type
string
Default
'validationResults'
The name of the variable to store the current error

for

for
Type
string
Default
''
The name of the error name (e.g. argument name or property name). This can also be a property path (like blog.title), and will then only display the validation errors of that property.

Format.bytes ViewHelper <f:format.bytes> 

Formats an integer with a byte count into human readable form.

Examples 

Simple 

{fileSize -> f:format.bytes()}
Copied!

123 KB Depending on the value of {fileSize}.

With arguments 

{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')}
Copied!

1,023.00 B Depending on the value of {fileSize}.

You may provide an own set of units, like this: B,KB,MB,GB,TB,PB,EB,ZB,YB.

Custom units 

{fileSize -> f:format.bytes(units: '{f:translate(\'viewhelper.format.bytes.units\', \'fluid\')}'
Copied!

123 KB Depending on the value of {fileSize}.

Go to the source code of this ViewHelper: Format\BytesViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.bytes ViewHelper:

decimalSeparator

decimalSeparator
Type
string
Default
'.'
The decimal point character

decimals

decimals
Type
int
Default
0
The number of digits after the decimal point

thousandsSeparator

thousandsSeparator
Type
string
Default
','
The character for grouping the thousand digits

units

units
Type
string
comma separated list of available units, default is LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid')

value

value
Type
int
The incoming data to convert, or NULL if VH children should be used

Format.case ViewHelper <f:format.case> 

Modifies the case of an input string to upper- or lowercase or capitalization. The default transformation will be uppercase as in mb_convert_case.

Possible modes are:

lower
Transforms the input string to its lowercase representation
upper
Transforms the input string to its uppercase representation
capital
Transforms the input string to its first letter upper-cased, i.e. capitalization
uncapital
Transforms the input string to its first letter lower-cased, i.e. uncapitalization
capitalWords
Transforms the input string to each containing word being capitalized

Note that the behavior will be the same as in the appropriate PHP function mb_convert_case; especially regarding locale and multibyte behavior.

Examples 

Default 

<f:format.case>Some Text with miXed case</f:format.case>
Copied!

Output:

SOME TEXT WITH MIXED CASE
Copied!

Example with given mode 

<f:format.case mode="capital">someString</f:format.case>
Copied!

Output:

SomeString
Copied!

Go to the source code of this ViewHelper: Format\CaseViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.case ViewHelper:

mode

mode
Type
string
Default
'upper'
The case to apply, must be one of this' CASE_* constants. Defaults to uppercase application.

value

value
Type
string
The input value. If not given, the evaluated child nodes will be used.

Format.cdata ViewHelper <f:format.cdata> 

Outputs an argument/value without any escaping and wraps it with CDATA tags.

PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting), as the output is NOT SANITIZED!

Examples 

Child nodes 

<f:format.cdata>{string}</f:format.cdata>
Copied!

Output:

<![CDATA[(Content of {string} without any conversion/escaping)]]>
Copied!

Value attribute 

<f:format.cdata value="{string}" />
Copied!

Output:

<![CDATA[(Content of {string} without any conversion/escaping)]]>
Copied!

Inline notation 

{string -> f:format.cdata()}
Copied!

Output:

<![CDATA[(Content of {string} without any conversion/escaping)]]>
Copied!

Go to the source code of this ViewHelper: Format\CdataViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.cdata ViewHelper:

value

value
Type
mixed
The value to output

Format.crop ViewHelper <f:format.crop> 

Use this ViewHelper to crop the text between its opening and closing tags.

Whitespace within the f:format.crop element will be considered as characters.

Examples 

Defaults 

<f:format.crop maxCharacters="10">
This is some very long text
</f:format.crop>
Copied!

This is...

The third word "some" does not fit in the 10 character limit, because respectWordBoundaries is true by default.

Custom suffix 

<f:format.crop maxCharacters="17" append="&nbsp;[more]">
This is some very long text
</f:format.crop>
Copied!

This is some&nbsp;[more]

Don't respect word boundaries 

<f:format.crop maxCharacters="10" respectWordBoundaries="false">
This is some very long text
</f:format.crop>
Copied!

This is s...

Don't respect HTML tags 

<f:format.crop maxCharacters="28" respectWordBoundaries="false" respectHtml="false">
This is some text with <strong>HTML</strong> tags
</f:format.crop>
Copied!

This is some text with <stro

Inline notation 

{someLongText -> f:format.crop(maxCharacters: 10)}
Copied!

someLongText cropped after 10 characters… Depending on the value of {someLongText}.

Go to the source code of this ViewHelper: Format\CropViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.crop ViewHelper:

append

append
Type
string
Default
'&hellip;'
What to append, if truncation happened

maxCharacters

maxCharacters
Type
int
Required
1
Place where to truncate the string

respectHtml

respectHtml
Type
bool
Default
true
If TRUE the cropped string will respect HTML tags and entities. Technically that means, that cropHTML() is called rather than crop()

respectWordBoundaries

respectWordBoundaries
Type
bool
Default
true
If TRUE and division is in the middle of a word, the remains of that word is removed.

Format.currency ViewHelper <f:format.currency> 

Formats a given float to a currency representation.

Examples 

Defaults 

<f:format.currency>123.456</f:format.currency>
Copied!

Output:

123,46
Copied!

All parameters 

<f:format.currency decimalSeparator="." thousandsSeparator="," decimals="2"
    currencySign="$" prependCurrency="true" separateCurrency="false"
>
    54321
</f:format.currency>
Copied!

Output:

$54,321.00
Copied!

Inline notation 

{someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: 'EUR')}
Copied!

Output:

54,321,00 EUR
Copied!

Depending on the value of {someNumber}.

Use dash for decimals without value 

<f:format.currency useDash="true">123.00</f:format.currency>
Copied!

Output:

123,-
Copied!

Go to the source code of this ViewHelper: Format\CurrencyViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.currency ViewHelper:

currencySign

currencySign
Type
string
Default
''
The currency sign, eg $ or €.

decimalSeparator

decimalSeparator
Type
string
Default
','
The separator for the decimal point.

decimals

decimals
Type
int
Default
2
Set decimals places.

prependCurrency

prependCurrency
Type
bool
Default
false
Select if the currency sign should be prepended

separateCurrency

separateCurrency
Type
bool
Default
true
Separate the currency sign from the number by a single space, defaults to true due to backwards compatibility

thousandsSeparator

thousandsSeparator
Type
string
Default
'.'
The thousands separator.

useDash

useDash
Type
bool
Default
false
Use the dash instead of decimal 00

Format.date ViewHelper <f:format.date> 

Formats an object implementing \DateTimeInterface.

Possible date/time formats can be found in the PHP documentation: https://www.php.net/manual/datetime.format.php

Examples 

Defaults 

<f:format.date>{dateObject}</f:format.date>
Copied!

1980-12-13 Depending on the current date.

Custom date format 

<f:format.date format="H:i">{dateObject}</f:format.date>
Copied!

01:23 Depending on the current time.

Relative date with given time 

<f:format.date format="Y" base="{dateObject}">-1 year</f:format.date>
Copied!

2016 Assuming dateObject is in 2017.

strtotime string 

<f:format.date format="d.m.Y - H:i:s">+1 week 2 days 4 hours 2 seconds</f:format.date>
Copied!

13.12.1980 - 21:03:42 Depending on the current time, see https://www.php.net/manual/function.strtotime.php.

Localized dates using strftime date format 

<f:format.date format="%d. %B %Y">{dateObject}</f:format.date>
Copied!

13. Dezember 1980 Depending on the current date and defined locale. In the example you see the 1980-12-13 in a german locale.

Localized dates using ICU-based date and time formatting 

<f:format.date pattern="dd. MMMM yyyy" locale="de-DE">{dateObject}</f:format.date>
Copied!

13. Dezember 1980 Depending on the current date. In the example you see the 1980-12-13 in a german locale.

Localized dates using default formatting patterns 

<f:format.date pattern="FULL" locale="fr-FR">{dateObject}</f:format.date>
Copied!

jeudi 9 mars 2023 à 21:40:49 temps universel coordonné Depending on the current date and operating system setting. In the example you see the 2023-03-09 in a french locale.

Inline notation 

{f:format.date(date: dateObject)}
Copied!

1980-12-13 Depending on the value of {dateObject}.

Inline notation (2nd variant) 

{dateObject -> f:format.date()}
Copied!

1980-12-13 Depending on the value of {dateObject}.

Go to the source code of this ViewHelper: Format\DateViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.date ViewHelper:

base

base
Type
mixed
A base time (an object implementing DateTimeInterface or a string) used if $date is a relative date specification. Defaults to current time.

date

date
Type
mixed
Either an object implementing DateTimeInterface or a string that is accepted by DateTime constructor

format

format
Type
string
Default
''
Format String which is taken to format the Date/Time

locale

locale
Type
string
A locale format such as "nl-NL" to format the date in a specific locale, if none given, uses the current locale of the current request. Only works when pattern argument is given

pattern

pattern
Type
string
Format date based on unicode ICO format pattern given see https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax. If both "pattern" and "format" arguments are given, pattern will be used.

Format.html ViewHelper <f:format.html> 

Renders a string by passing it to a TYPO3 parseFunc. You can either specify a path to the TypoScript setting or set the parseFunc options directly. By default lib.parseFunc_RTE is used to parse the string.

The view helper must not be used in backend context, as it triggers frontend logic. Instead, use <f:sanitize.html /> to secure a given HTML string or <f:transform.html /> to parse links in HTML.

Examples 

Default parameters 

<f:format.html>{$myConstant.project} is a cool <b>CMS</b> (<a href="https://www.typo3.org">TYPO3</a>).</f:format.html>
Copied!

Output:

<p class="bodytext">TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).</p>
Copied!

Depending on TYPO3 constants.

Custom parseFunc 

<f:format.html parseFuncTSPath="lib.parseFunc">TYPO3 is a cool <b>CMS</b> (<a href="https://www.typo3.org">TYPO3</a>).</f:format.html>
Copied!

Output:

TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).
Copied!

Data argument 

If you work with TypoScript field property, you should add the current record as data to the ViewHelper to allow processing the field and dataWrap properties correctly.

<f:format.html data="{newsRecord}" parseFuncTSPath="lib.news">News title: </f:format.html>
Copied!

After "dataWrap = |<strong>{FIELD:title}</strong>" you may have this Output:

News title: <strong>TYPO3, greatest CMS ever</strong>
Copied!

Current argument 

Use the current argument to set the current value of the content object.

<f:format.html current="{strContent}" parseFuncTSPath="lib.info">I'm gone</f:format.html>
Copied!

After setContentToCurrent = 1 you may have this output:

Thanks Kasper for this great CMS
Copied!

CurrentValueKey argument 

Use the currentValueKey argument to define a value of data object as the current value.

<f:format.html data="{contentRecord}" currentValueKey="header" parseFuncTSPath="lib.content">Content: </f:format.html>
Copied!

After dataWrap = |{CURRENT:1} you may have this Output:

Content: How to install TYPO3 in under 2 minutes ;-)
Copied!

Inline notation 

{someText -> f:format.html(parseFuncTSPath: 'lib.parseFunc')}
Copied!

Output:

TYPO3 is a cool <strong>CMS</strong> (<a href="https://www.typo3.org" target="_blank">TYPO3</a>).
Copied!

Go to the source code of this ViewHelper: Format\HtmlViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.html ViewHelper:

current

current
Type
string
Initialize the content object with this value for current property.

currentValueKey

currentValueKey
Type
string
Define the value key, used to locate the current value for the content object

data

data
Type
mixed
Initialize the content object with this set of data. Either an array or object.

parseFuncTSPath

parseFuncTSPath
Type
string
Default
'lib.parseFunc_RTE'
Path to the TypoScript parseFunc setup.

table

table
Type
string
Default
''
The table name associated with the "data" argument.

Format.htmlentities ViewHelper <f:format.htmlentities> 

Applies htmlentities() escaping to a value. See https://www.php.net/manual/function.htmlentities.php.

Examples 

Default notation 

<f:format.htmlentities>{text}</f:format.htmlentities>
Copied!

Text containing the following signs & " ' < > will be processed by htmlentities(). These will result in: &amp; &quot; &#039; &lt; &gt;.

Inline notation 

{text -> f:format.htmlentities(encoding: 'ISO-8859-1')}
Copied!

Text containing the following signs & " ' < > will be processed by htmlentities(). These will result in: &amp; &quot; &#039; &lt; &gt;.

But encoded as ISO-8859-1.

Go to the source code of this ViewHelper: Format\HtmlentitiesViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.htmlentities ViewHelper:

doubleEncode

doubleEncode
Type
bool
Default
true
If FALSE existing html entities won't be encoded, the default is to convert everything.

encoding

encoding
Type
string
Define the encoding used when converting characters (Default: UTF-8

keepQuotes

keepQuotes
Type
bool
Default
false
If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).

value

value
Type
string
string to format

Format.htmlentitiesDecode ViewHelper <f:format.htmlentitiesDecode> 

Applies html_entity_decode() to a value. See https://www.php.net/html_entity_decode.

Examples 

Default notation 

<f:format.htmlentitiesDecode>{text}</f:format.htmlentitiesDecode>
Copied!

Text containing the following escaped signs: &amp; &quot; &#039; &lt; &gt;, will be processed by html_entity_decode(). These will result in: & " ' < >.

Inline notation 

{text -> f:format.htmlentitiesDecode(encoding: 'ISO-8859-1')}
Copied!

Text containing the following escaped signs: &amp; &quot; &#039; &lt; &gt;, will be processed by html_entity_decode(). These will result in: & " ' < >.

But encoded as ISO-8859-1.

Go to the source code of this ViewHelper: Format\HtmlentitiesDecodeViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.htmlentitiesDecode ViewHelper:

encoding

encoding
Type
string
Define the encoding used when converting characters (Default: UTF-8).

keepQuotes

keepQuotes
Type
bool
Default
false
If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).

value

value
Type
string
string to format

Format.htmlspecialchars ViewHelper <f:format.htmlspecialchars> 

Applies PHP htmlspecialchars() escaping to a value.

See http://www.php.net/manual/function.htmlspecialchars.php

Examples 

Default notation 

<f:format.htmlspecialchars>{text}</f:format.htmlspecialchars>
Copied!

Output:

Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
Copied!

Inline notation 

{text -> f:format.htmlspecialchars(encoding: 'ISO-8859-1')}
Copied!

Output:

Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
Copied!

Go to the source code of this ViewHelper: Format\HtmlspecialcharsViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.htmlspecialchars ViewHelper:

doubleEncode

doubleEncode
Type
boolean
Default
true
If false, html entities will not be encoded

encoding

encoding
Type
string
Default
'UTF-8'
Encoding

keepQuotes

keepQuotes
Type
boolean
Default
false
If true quotes will not be replaced (ENT_NOQUOTES)

value

value
Type
string
Value to format

Format.json ViewHelper <f:format.json> 

Wrapper for PHPs json_encode function. See https://www.php.net/manual/function.json-encode.php.

Examples 

Encoding a view variable 

{someArray -> f:format.json()}
Copied!

["array","values"] Depending on the value of {someArray}.

Associative array 

{f:format.json(value: {foo: 'bar', bar: 'baz'})}
Copied!

{"foo":"bar","bar":"baz"}

Non associative array with forced object 

{f:format.json(value: {0: 'bar', 1: 'baz'}, forceObject: true)}
Copied!

{"0":"bar","1":"baz"}

Go to the source code of this ViewHelper: Format\JsonViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.json ViewHelper:

forceObject

forceObject
Type
bool
Default
false
Outputs an JSON object rather than an array

value

value
Type
mixed
The incoming data to convert, or null if VH children should be used

Format.nl2br ViewHelper <f:format.nl2br> 

Wrapper for PHPs nl2br function. See https://www.php.net/manual/function.nl2br.php.

Examples 

Default 

<f:format.nl2br>{text_with_linebreaks}</f:format.nl2br>
Copied!

Text with line breaks replaced by <br />

Inline notation 

{text_with_linebreaks -> f:format.nl2br()}
Copied!

Text with line breaks replaced by <br />

Go to the source code of this ViewHelper: Format\Nl2brViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.nl2br ViewHelper:

value

value
Type
string
string to format

Format.number ViewHelper <f:format.number> 

Formats a number with custom precision, decimal point and grouped thousands. See https://www.php.net/manual/function.number-format.php.

Examples 

Defaults 

<f:format.number>423423.234</f:format.number>
Copied!

423,423.20

With all parameters 

<f:format.number decimals="1" decimalSeparator="," thousandsSeparator=".">
    423423.234
</f:format.number>
Copied!

423.423,2

Go to the source code of this ViewHelper: Format\NumberViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.number ViewHelper:

decimalSeparator

decimalSeparator
Type
string
Default
'.'
The decimal point character

decimals

decimals
Type
int
Default
2
The number of digits after the decimal point

thousandsSeparator

thousandsSeparator
Type
string
Default
','
The character for grouping the thousand digits

Format.padding ViewHelper <f:format.padding> 

Formats a string using PHPs str_pad function. See https://www.php.net/manual/en/function.str-pad.

Examples 

Defaults 

<f:format.padding padLength="10">TYPO3</f:format.padding>
Copied!

Output:

TYPO3␠␠␠␠␠
Copied!

TYPO3␠␠␠␠␠

Specify padding string 

<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
Copied!

TYPO3-=-=-

Specify padding type 

<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
Copied!

--TYPO3---

Go to the source code of this ViewHelper: Format\PaddingViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.padding ViewHelper:

padLength

padLength
Type
int
Required
1
Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, no padding takes place.

padString

padString
Type
string
Default
' '
The padding string

padType

padType
Type
string
Default
'right'
Append the padding at this site (Possible values: right,left,both. Default: right)

value

value
Type
string
string to format

Format.printf ViewHelper <f:format.printf> 

A ViewHelper for formatting values with printf. Either supply an array for the arguments or a single value.

See http://www.php.net/manual/en/function.sprintf.php

Examples 

Scientific notation 

<f:format.printf arguments="{number: 362525200}">%.3e</f:format.printf>
Copied!

Output:

3.625e+8
Copied!

Argument swapping 

<f:format.printf arguments="{0: 3, 1: 'Kasper'}">%2$s is great, TYPO%1$d too. Yes, TYPO%1$d is great and so is %2$s!</f:format.printf>
Copied!

Output:

Kasper is great, TYPO3 too. Yes, TYPO3 is great and so is Kasper!
Copied!

Single argument 

<f:format.printf arguments="{1: 'TYPO3'}">We love %s</f:format.printf>

Copied!

Output:

We love TYPO3
Copied!

Inline notation 

{someText -> f:format.printf(arguments: {1: 'TYPO3'})}

Copied!

Output:

We love TYPO3
Copied!

Go to the source code of this ViewHelper: Format\PrintfViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.printf ViewHelper:

arguments

arguments
Type
array
Default
array ( )
The arguments for vsprintf

value

value
Type
string
String to format

Format.raw ViewHelper <f:format.raw> 

Outputs an argument/value without any escaping. Is normally used to output an ObjectAccessor which should not be escaped, but output as-is.

PAY SPECIAL ATTENTION TO SECURITY HERE (especially Cross Site Scripting), as the output is NOT SANITIZED!

Examples 

Child nodes 

<f:format.raw>{string}</f:format.raw>
Copied!

Output:

(Content of ``{string}`` without any conversion/escaping)
Copied!

Value attribute 

<f:format.raw value="{string}" />
Copied!

Output:

(Content of ``{string}`` without any conversion/escaping)
Copied!

Inline notation 

{string -> f:format.raw()}
Copied!

Output:

(Content of ``{string}`` without any conversion/escaping)
Copied!

Go to the source code of this ViewHelper: Format\RawViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.raw ViewHelper:

value

value
Type
mixed
The value to output

Format.stripTags ViewHelper <f:format.stripTags> 

Removes tags from the given string (applying PHPs strip_tags() function) See https://www.php.net/manual/function.strip-tags.php.

Examples 

Default notation 

<f:format.stripTags>Some Text with <b>Tags</b> and an &Uuml;mlaut.</f:format.stripTags>
Copied!

Some Text with Tags and an &Uuml;mlaut. strip_tags() applied.

Default notation with allowedTags 

<f:format.stripTags allowedTags="<p><span><div><script>">
    <p>paragraph</p><span>span</span><div>divider</div><iframe>iframe</iframe><script>script</script>
</f:format.stripTags>
Copied!

Output:

<p>paragraph</p><span>span</span><div>divider</div>iframe<script>script</script>
Copied!

Inline notation 

{text -> f:format.stripTags()}
Copied!

Text without tags strip_tags() applied.

Inline notation with allowedTags 

{text -> f:format.stripTags(allowedTags: "<p><span><div><script>")}
Copied!

Text with p, span, div and script Tags inside, all other tags are removed.

Go to the source code of this ViewHelper: Format\StripTagsViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.stripTags ViewHelper:

allowedTags

allowedTags
Type
string
Optional string of allowed tags as required by PHPs strip_tags() function

value

value
Type
string
string to format

Format.trim ViewHelper <f:format.trim> 

This ViewHelper strips whitespace (or other characters) from the beginning and end of a string.

Possible sides are:

both (default)
Strip whitespace (or other characters) from the beginning and end of a string
left or start
Strip whitespace (or other characters) from the beginning of a string
right or end
Strip whitespace (or other characters) from the end of a string

Examples 

Defaults 

#<f:format.trim>   String to be trimmed.   </f:format.trim>#
Copied!
#String to be trimmed.#
Copied!

Trim only one side 

#<f:format.trim side="right">   String to be trimmed.   </f:format.trim>#
Copied!
#   String to be trimmed.#
Copied!

Trim special characters 

#<f:format.trim characters=" St.">   String to be trimmed.   </f:format.trim>#
Copied!
#ring to be trimmed#
Copied!

Go to the source code of this ViewHelper: Format\TrimViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.trim ViewHelper:

characters

characters
Type
string
Optionally, the stripped characters can also be specified using the characters parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.

side

side
Type
string
Default
'both'
The side to apply, must be one of this' CASE_* constants. Defaults to both application.

value

value
Type
string
The string value to be trimmed. If not given, the evaluated child nodes will be used.

Format.urlencode ViewHelper <f:format.urlencode> 

Encodes the given string according to http://www.faqs.org/rfcs/rfc3986.html Applying PHPs rawurlencode() function. See https://www.php.net/manual/function.rawurlencode.php.

Examples 

Default notation 

<f:format.urlencode>foo @+%/</f:format.urlencode>
Copied!

foo%20%40%2B%25%2F rawurlencode() applied.

Inline notation 

{text -> f:format.urlencode()}
Copied!

Url encoded text rawurlencode() applied.

Go to the source code of this ViewHelper: Format\UrlencodeViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.urlencode ViewHelper:

value

value
Type
string
string to format

Sanitize.html ViewHelper <f:sanitize.html> 

Passes a given content through typo3/html-sanitizer to mitigate potential cross-site scripting occurrences. Given default build corresponds to class TYPO3\CMS\Core\Html\DefaultSanitizerBuilder declaring allowed HTML tags, attributes and their values.

Examples 

Default parameters 

<f:sanitize.html>
  <img src="/img.png" class="image" onmouseover="alert(document.location)">
</f:sanitize.html>
Copied!

Output:

<img src="/img.png" class="image">
Copied!

Inline notation 

{richTextFieldContent -> f:sanitize.html(build: 'default')}
Copied!

Go to the source code of this ViewHelper: Sanitize\HtmlViewHelper.php (GitHub).

Arguments

The following arguments are available for the sanitize.html ViewHelper:

build

build
Type
string
Default
'default'
preset name or class-like name of sanitization builder

Security.ifAuthenticated ViewHelper <f:security.ifAuthenticated> 

This ViewHelper implements an ifAuthenticated/else condition for frontend users.

Examples 

Basic usage 

<f:security.ifAuthenticated>
   This is being shown whenever a FE user is logged in
</f:security.ifAuthenticated>
Copied!

Everything inside the <f:security.ifAuthenticated> tag is being displayed if current frontend user is authenticated.

IfAuthenticated / then / else 

<f:security.ifAuthenticated>
   <f:then>
      This is being shown in case you have access.
   </f:then>
   <f:else>
      This is being displayed in case you do not have access.
   </f:else>
</f:security.ifAuthenticated>
Copied!

Everything inside the <f:then></f:then> tag is displayed if frontend user is authenticated. Otherwise, everything inside the <f:else></f:else> tag is displayed.

Go to the source code of this ViewHelper: Security\IfAuthenticatedViewHelper.php (GitHub).

Arguments

The following arguments are available for the security.ifAuthenticated ViewHelper:

else

else
Type
mixed
Value to be returned if the condition if not met.

then

then
Type
mixed
Value to be returned if the condition if met.

Security.ifHasRole ViewHelper <f:security.ifHasRole> 

This ViewHelper implements an ifHasRole/else condition for frontend groups.

Examples 

Basic usage 

<f:security.ifHasRole role="Administrator">
    This is being shown in case the current FE user belongs to a FE usergroup (aka role) titled "Administrator" (case sensitive)
</f:security.ifHasRole>
Copied!

Everything inside the <f:security.ifHasRole> tag is being displayed if the logged in frontend user belongs to the specified frontend user group. Comparison is done by comparing to title of the user groups.

Using the usergroup uid as role identifier 

<f:security.ifHasRole role="1">
   This is being shown in case the current FE user belongs to a FE usergroup (aka role) with the uid "1"
</f:security.ifHasRole>
Copied!

Everything inside the <f:security.ifHasRole> tag is being displayed if the logged in frontend user belongs to the specified role. Comparison is done using the uid of frontend user groups.

IfRole / then / else 

<f:security.ifHasRole role="Administrator">
   <f:then>
      This is being shown in case you have the role.
   </f:then>
   <f:else>
      This is being displayed in case you do not have the role.
   </f:else>
</f:security.ifHasRole>
Copied!

Everything inside the <f:then></f:then> tag is displayed if the logged in FE user belongs to the specified role. Otherwise, everything inside the <f:else></f:else> tag is displayed.

Go to the source code of this ViewHelper: Security\IfHasRoleViewHelper.php (GitHub).

Arguments

The following arguments are available for the security.ifHasRole ViewHelper:

else

else
Type
mixed
Value to be returned if the condition if not met.

role

role
Type
string
The usergroup (either the usergroup uid or its title).

then

then
Type
mixed
Value to be returned if the condition if met.

Security.nonce ViewHelper <f:security.nonce> 

This ViewHelper resolves the nonce attribute from the global server request object, or from the PolicyProvider service as a fall-back value.

Examples 

Basic usage 

<script nonce="{f:security.nonce()}">const inline = 'script';</script>
Copied!

Go to the source code of this ViewHelper: Security\NonceViewHelper.php (GitHub).

Transform.html ViewHelper <f:transform.html> 

Transforms HTML and substitutes internal link scheme aspects.

Examples 

Default parameters 

<f:transform.html selector="a.href" onFailure="removeEnclosure">
  <a href="t3://page?uid=1" class="home">Home</a>
</f:transform.html>
Copied!

Output:

<a href="https://example.com/home" class="home">Home</a>
Copied!

Inline notation 

{content -> f:transform.html(selector:'a.href', onFailure:'removeEnclosure')}
Copied!

Go to the source code of this ViewHelper: Transform\HtmlViewHelper.php (GitHub).

Arguments

The following arguments are available for the transform.html ViewHelper:

onFailure

onFailure
Type
string
Default
'removeEnclosure'
behavior on failure, either `removeTag`, `removeAttr`, `removeEnclosure` or `null`

selector

selector
Type
string
Default
'a.href'
comma separated list of node attributes to be considered

Uri.action ViewHelper <f:uri.action> 

A ViewHelper for creating URIs to extbase actions. Tailored for extbase plugins, uses extbase Request and extbase UriBuilder.

Examples 

URI to the show-action of the current controller:

<f:uri.action action="show" />
Copied!

/page/path/name.html?tx_myextension_plugin[action]=show&tx_myextension_plugin[controller]=Standard&cHash=xyz

Depending on current page, routing and page path configuration.

Go to the source code of this ViewHelper: Uri\ActionViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.action ViewHelper:

absolute

absolute
Type
bool
Default
false
If set, an absolute URI is rendered

action

action
Type
string
Target action

addQueryString

addQueryString
Type
string
Default
false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.

additionalParams

additionalParams
Type
array
Default
array ( )
additional query parameters that won't be prefixed like $arguments (overrule $arguments)

arguments

arguments
Type
array
Default
array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)

argumentsToBeExcludedFromQueryString

argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the URI. Only active if $addQueryString = TRUE

controller

controller
Type
string
Target controller. If NULL current controllerName is used

extensionName

extensionName
Type
string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used

format

format
Type
string
Default
''
The requested format, e.g. ".html

language

language
Type
string
link to a specific language - defaults to the current language, use a language ID or "current" to enforce a specific language

linkAccessRestrictedPages

linkAccessRestrictedPages
Type
bool
Default
false
If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.

noCache

noCache
Type
bool
Set this to disable caching for the target page. You should not need this.

pageType

pageType
Type
int
Default
0
Type of the target page. See typolink.parameter

pageUid

pageUid
Type
int
Target page. See TypoLink destination

pluginName

pluginName
Type
string
Target plugin. If empty, the current plugin name is used

section

section
Type
string
Default
''
The anchor to be added to the URI

Uri.external ViewHelper <f:uri.external> 

A ViewHelper for creating URIs to external targets. Currently the specified URI is simply passed through.

Examples 

Default 

<f:uri.external uri="https://www.typo3.org" />
Copied!

https://www.typo3.org

Custom default scheme 

<f:uri.external uri="typo3.org" defaultScheme="ftp" />
Copied!

ftp://typo3.org

Go to the source code of this ViewHelper: Uri\ExternalViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.external ViewHelper:

defaultScheme

defaultScheme
Type
string
Default
'https'
scheme the href attribute will be prefixed with if specified $uri does not contain a scheme already

uri

uri
Type
string
Required
1
target URI

Uri.image ViewHelper <f:uri.image> 

Resizes a given image (if required) and returns its relative path.

This ViewHelper should only be used for images within FAL storages, or where graphical operations shall be performed.

Note that when the contents of a non-FAL image are changed, an image may not show updated processed contents unless either the FAL record is updated/removed, or the temporary processed images are cleared.

Also note that image operations (cropping, scaling, converting) on non-FAL files may be changed in future TYPO3 versions, since those operations are coupled with FAL metadata. Each non-FAL image operation creates a "fake" FAL record, which may lead to problems.

For extension resource files, use <f:uri.resource> instead.

External URLs are not processed and just returned as is.

Examples 

Default 

<f:uri.image src="EXT:myext/Resources/Public/typo3_logo.png" />
Copied!

Results in the following output within TYPO3 frontend:

typo3conf/ext/myext/Resources/Public/typo3_logo.png

and the following output inside TYPO3 backend:

../typo3conf/ext/myext/Resources/Public/typo3_logo.png

Image Object 

<f:uri.image image="{imageObject}" />
Copied!

Results in the following output within TYPO3 frontend:

fileadmin/images/image.png

and the following output inside TYPO3 backend:

fileadmin/images/image.png

Inline notation 

{f:uri.image(src: 'EXT:myext/Resources/Public/typo3_logo.png', minWidth: 30, maxWidth: 40)}
Copied!

typo3temp/assets/images/[b4c0e7ed5c].png

Depending on your TYPO3s encryption key.

Non existing image 

<f:uri.image src="NonExistingImage.png" />
Copied!

Could not get image resource for "NonExistingImage.png".

Go to the source code of this ViewHelper: Uri\ImageViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.image ViewHelper:

absolute

absolute
Type
bool
Default
false
Force absolute URL

crop

crop
Type
string|bool|array
overrule cropping of image (setting to FALSE disables the cropping set in FileReference)

cropVariant

cropVariant
Type
string
Default
'default'
select a cropping variant, in case multiple croppings have been specified or stored in FileReference

fileExtension

fileExtension
Type
string
Custom file extension to use

height

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

image

image
Type
object
image

maxHeight

maxHeight
Type
int
maximum height of the image

maxWidth

maxWidth
Type
int
maximum width of the image

minHeight

minHeight
Type
int
minimum height of the image

minWidth

minWidth
Type
int
minimum width of the image

src

src
Type
string
Default
''
src

treatIdAsReference

treatIdAsReference
Type
bool
Default
false
given src argument is a sys_file_reference record

width

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

Uri.page ViewHelper <f:uri.page> 

A ViewHelper for creating URIs to TYPO3 pages.

Examples 

URI to the current page 

<f:uri.page>page link</f:uri.page>
Copied!

/page/path/name.html

Depending on current page, routing and page path configuration.

Query parameters 

<f:uri.page pageUid="1" additionalParams="{foo: 'bar'}" />
Copied!

/page/path/name.html?foo=bar

Depending on current page, routing and page path configuration.

Query parameters for extensions 

<f:uri.page pageUid="1" additionalParams="{extension_key: {foo: 'bar'}}" />
Copied!

/page/path/name.html?extension_key[foo]=bar

Depending on current page, routing and page path configuration.

Go to the source code of this ViewHelper: Uri\PageViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.page ViewHelper:

absolute

absolute
Type
bool
Default
false
If set, the URI of the rendered link is absolute

addQueryString

addQueryString
Type
string
Default
false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.

additionalParams

additionalParams
Type
array
Default
array ( )
query parameters to be attached to the resulting URI

argumentsToBeExcludedFromQueryString

argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the URI. Only active if $addQueryString = TRUE

language

language
Type
string
link to a specific language - defaults to the current language, use a language ID or "current" to enforce a specific language

linkAccessRestrictedPages

linkAccessRestrictedPages
Type
bool
Default
false
If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.

noCache

noCache
Type
bool
Default
false
set this to disable caching for the target page. You should not need this.

pageType

pageType
Type
int
Default
0
type of the target page. See typolink.parameter

pageUid

pageUid
Type
int
target PID

section

section
Type
string
Default
''
the anchor to be added to the URI

Uri.resource ViewHelper <f:uri.resource> 

A ViewHelper for creating URIs to resources.

This ViewHelper should be used for extension resource files.

For images within FAL storages, or where graphical operations are performed, use <f:uri.image> instead.

Examples 

Best practice with EXT: syntax 

<link href="{f:uri.resource(path:'EXT:indexed_search/Resources/Public/Css/Stylesheet.css')}" rel="stylesheet" />
Copied!

Output:

<link href="typo3/sysext/indexed_search/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!

Preferred syntax that works in both extbase and non-extbase context.

Defaults 

<link href="{f:uri.resource(path:'Css/Stylesheet.css')}" rel="stylesheet" />
Copied!

Output:

<link href="typo3conf/ext/example_extension/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!

Works only in extbase context since it uses the extbase request to find current extension, magically adds 'Resources/Public' to path.

With extension name 

<link href="{f:uri.resource(path:'Css/Stylesheet.css', extensionName: 'AnotherExtension')}" rel="stylesheet" />
Copied!

Output:

<link href="typo3conf/ext/another_extension/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!

Magically adds 'Resources/Public' to path.

Go to the source code of this ViewHelper: Uri\ResourceViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.resource ViewHelper:

absolute

absolute
Type
bool
Default
false
If set, an absolute URI is rendered

extensionName

extensionName
Type
string
Target extension name. If not set, the current extension name will be used

path

path
Type
string
Required
1
The path and filename of the resource (relative to Public resource directory of the extension).

Alias ViewHelper <f:alias> 

Declares new variables which are aliases of other variables. Takes a "map"-Parameter which is an associative array which defines the shorthand mapping.

The variables are only declared inside the <f:alias>...</f:alias> tag. After the closing tag, all declared variables are removed again.

Using this ViewHelper can be a sign of weak architecture. If you end up using it extensively you might want to fine-tune your "view model" (the data you assign to the view).

Examples 

Single alias 

<f:alias map="{x: 'foo'}">{x}</f:alias>
Copied!

Output:

foo
Copied!

Multiple mappings 

<f:alias map="{x: foo.bar.baz, y: foo.bar.baz.name}">
    {x.name} or {y}
</f:alias>
Copied!

Output:

[name] or [name]
Copied!

Depending on {foo.bar.baz}.

Go to the source code of this ViewHelper: AliasViewHelper.php (GitHub).

Arguments

The following arguments are available for the alias ViewHelper:

map

map
Type
array
Required
1
Array that specifies which variables should be mapped to which alias

Case ViewHelper <f:case> 

Case ViewHelper that is only usable within the f:switch ViewHelper.

Go to the source code of this ViewHelper: CaseViewHelper.php (GitHub).

Arguments

The following arguments are available for the case ViewHelper:

value

value
Type
mixed
Required
1
Value to match in this case

CObject ViewHelper <f:cObject> 

This ViewHelper renders CObjects from the global TypoScript configuration.

Examples 

Render lib object 

<f:cObject typoscriptObjectPath="lib.someLibObject" />
Copied!

Rendered lib.someLibObject.

Specify cObject data & current value 

<f:cObject typoscriptObjectPath="lib.customHeader" data="{article}" currentValueKey="title" />
Copied!

Rendered lib.customHeader. Data and current value will be available in TypoScript.

Inline notation 

{article -> f:cObject(typoscriptObjectPath: 'lib.customHeader')}
Copied!

Rendered lib.customHeader. Data will be available in TypoScript.

Accessing the data in TypoScript 

lib.customHeader = COA
lib.customHeader {
    10 = TEXT
    10.field = author
    20 = TEXT
    20.current = 1
}
Copied!

When passing an object with {data}, the properties of the object are accessible with .field in TypoScript. If only a single value is passed or the currentValueKey is specified, .current = 1 can be used in the TypoScript.

Go to the source code of this ViewHelper: CObjectViewHelper.php (GitHub).

Arguments

The following arguments are available for the cObject ViewHelper:

currentValueKey

currentValueKey
Type
string
currentValueKey

data

data
Type
mixed
the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used

table

table
Type
string
Default
''
the table name associated with "data" argument. Typically tt_content or one of your custom tables. This argument should be set if rendering a FILES cObject where file references are used, or if the data argument is a database record.

typoscriptObjectPath

typoscriptObjectPath
Type
string
Required
1
the TypoScript setup path of the TypoScript object to render

Comment ViewHelper <f:comment> 

This ViewHelper prevents rendering of any content inside the tag.

Contents of the comment will still be parsed thus throwing an Exception if it contains syntax errors. You can put child nodes in CDATA tags to avoid this.

Using this ViewHelper won't have a notable effect on performance, especially once the template is parsed. However, it can lead to reduced readability. You can use layouts and partials to split a large template into smaller parts. Using self-descriptive names for the partials can make comments redundant.

Examples 

Commenting out fluid code 

Before
<f:comment>
    This is completely hidden.
    <f:debug>This does not get rendered</f:debug>
</f:comment>
After
Copied!

Output:

Before
After
Copied!

Prevent parsing 

<f:comment><![CDATA[
   <f:some.invalid.syntax />
]]></f:comment>
Copied!

Output:

Will be nothing.

Go to the source code of this ViewHelper: CommentViewHelper.php (GitHub).

Constant ViewHelper <f:constant> 

Wrapper for PHPs constant function. See https://www.php.net/manual/function.constant.php.

Examples 

Get built-in PHP constant 

{f:constant(name: 'PHP_INT_MAX')}
Copied!

Output:

9223372036854775807
(Depending on CPU architecture).
Copied!

Get class constant 

{f:constant(name: '\Vendor\Package\Class::CONSTANT')}
Copied!

Get enum value 

{f:constant(name: '\Vendor\Package\Enum::CASE')}
Copied!

Go to the source code of this ViewHelper: ConstantViewHelper.php (GitHub).

Arguments

The following arguments are available for the constant ViewHelper:

name

name
Type
string
String representation of a PHP constant or enum

Count ViewHelper <f:count> 

This ViewHelper counts elements of the specified array or countable object.

Examples 

Count array elements 

<f:count subject="{0:1, 1:2, 2:3, 3:4}" />
Copied!

Output:

4
Copied!

inline notation 

{objects -> f:count()}
Copied!

Output:

10 (depending on the number of items in ``{objects}``)
Copied!

Go to the source code of this ViewHelper: CountViewHelper.php (GitHub).

Arguments

The following arguments are available for the count ViewHelper:

subject

subject
Type
array
Countable subject, array or \Countable

Cycle ViewHelper <f:cycle> 

This ViewHelper cycles through the specified values. This can be often used to specify CSS classes for example.

To achieve the "zebra class" effect in a loop you can also use the "iteration" argument of the for ViewHelper.

Examples 

These examples could also be achieved using the "iteration" argument of the ForViewHelper.

Simple 

<f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo">
    <f:cycle values="{0: 'foo', 1: 'bar', 2: 'baz'}" as="cycle">
        {cycle}
    </f:cycle>
</f:for>
Copied!

Output:

foobarbazfoo
Copied!

Alternating CSS class 

<ul>
    <f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo">
        <f:cycle values="{0: 'odd', 1: 'even'}" as="zebraClass">
            <li class="{zebraClass}">{foo}</li>
        </f:cycle>
    </f:for>
</ul>
Copied!

Output:

<ul>
    <li class="odd">1</li>
    <li class="even">2</li>
    <li class="odd">3</li>
    <li class="even">4</li>
</ul>
Copied!

Go to the source code of this ViewHelper: CycleViewHelper.php (GitHub).

Arguments

The following arguments are available for the cycle ViewHelper:

as

as
Type
string
Required
1
The name of the iteration variable

values

values
Type
array
The array or object implementing \ArrayAccess (for example \SplObjectStorage) to iterated over

Debug ViewHelper <f:debug> 

This ViewHelper generates a HTML dump of the tagged variable.

Examples 

Simple 

<f:debug>{testVariables.array}</f:debug>
Copied!

foobarbazfoo

All Features 

<f:debug title="My Title" maxDepth="5"
    blacklistedClassNames="{0:'ACME\BlogExample\Domain\Model\Administrator'}"
    blacklistedPropertyNames="{0:'posts'}"
    plainText="true" ansiColors="false"
    inline="true"
    >
        {blogs}
    </f:debug>
Copied!

[A HTML view of the var_dump]

Go to the source code of this ViewHelper: DebugViewHelper.php (GitHub).

Arguments

The following arguments are available for the debug ViewHelper:

ansiColors

ansiColors
Type
bool
Default
false
If TRUE, ANSI color codes is added to the plaintext output, if FALSE (default) the plaintext debug output not colored.

blacklistedClassNames

blacklistedClassNames
Type
array
An array of class names (RegEx) to be filtered. Default is an array of some common class names.

blacklistedPropertyNames

blacklistedPropertyNames
Type
array
An array of property names and/or array keys (RegEx) to be filtered. Default is an array of some common property names.

inline

inline
Type
bool
Default
false
if TRUE, the dump is rendered at the position of the <f:debug> tag. If FALSE (default), the dump is displayed at the top of the page.

maxDepth

maxDepth
Type
int
Default
8
Sets the max recursion depth of the dump (defaults to 8). De- or increase the number according to your needs and memory limit.

plainText

plainText
Type
bool
Default
false
If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.

title

title
Type
string
optional custom title for the debug output

DefaultCase ViewHelper <f:defaultCase> 

A ViewHelper which specifies the "default" case when used within the f:switch ViewHelper.

Go to the source code of this ViewHelper: DefaultCaseViewHelper.php (GitHub).

Else ViewHelper <f:else> 

Else-Branch of a condition. Only has an effect inside of f:if. See the f:if ViewHelper for documentation.

Examples 

Output content if condition is not met 

<f:if condition="{someCondition}">
    <f:else>
        condition was not true
    </f:else>
</f:if>
Copied!

Output:

Everything inside the "else" tag is displayed if the condition evaluates to false.
Otherwise, nothing is outputted in this example.
Copied!

Go to the source code of this ViewHelper: ElseViewHelper.php (GitHub).

Arguments

The following arguments are available for the else ViewHelper:

if

if
Type
boolean
Condition expression conforming to Fluid boolean rules

First ViewHelper <f:first> 

The FirstViewHelper returns the first item of an array.

Example 

<f:first value="{0: 'first', 1: 'second'}" />
Copied!
first
Copied!

Go to the source code of this ViewHelper: FirstViewHelper.php (GitHub).

Arguments

The following arguments are available for the first ViewHelper:

value

value
Type
array

FlashMessages ViewHelper <f:flashMessages> 

ViewHelper which renders the flash messages (if there are any) as an unsorted list.

In case you need custom Flash Message HTML output, please write your own ViewHelper for the moment.

Examples 

Simple 

<f:flashMessages />
Copied!

A list of flash messages.

TYPO3 core style 

<f:flashMessages />
Copied!

Output:

<div class="typo3-messages">
   <div class="alert alert-info">
      <div class="media">
         <div class="media-left">
            <span class="icon-emphasized">
               <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-info" data-identifier="actions-info">
                  <span class="icon-markup">
                     <svg class="icon-color"><use xlink:href="/typo3/sysext/core/Resources/Public/Icons/T3Icons/sprites/actions.svg#actions-info"></use></svg>
                  </span>
               </span>
            </span>
         </div>
         <div class="media-body">
            <div class="alert-title">Info - Title for Info message</div>
            <p class="alert-message">Message text here.</p>
         </div>
      </div>
   </div>
</div>
Copied!

Output flash messages as a description list 

<f:flashMessages as="flashMessages">
   <dl class="messages">
      <f:for each="{flashMessages}" as="flashMessage">
         <dt>{flashMessage.code}</dt>
         <dd>{flashMessage.message}</dd>
      </f:for>
   </dl>
</f:flashMessages>
Copied!

Output:

 <dl class="messages">
    <dt>1013</dt>
    <dd>Some Warning Message.</dd>
</dl>
Copied!

Using a specific queue 

<f:flashMessages queueIdentifier="myQueue" />
Copied!

Go to the source code of this ViewHelper: FlashMessagesViewHelper.php (GitHub).

Arguments

The following arguments are available for the flashMessages ViewHelper:

as

as
Type
string
The name of the current flashMessage variable for rendering inside

queueIdentifier

queueIdentifier
Type
string
Flash-message queue to use

For ViewHelper <f:for> 

Loop ViewHelper which can be used to iterate over arrays. Implements what a basic PHP foreach() does.

Examples 

Simple Loop 

<f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo">{foo}</f:for>
Copied!

Output:

1234
Copied!

Output array key 

<ul>
    <f:for each="{fruit1: 'apple', fruit2: 'pear', fruit3: 'banana', fruit4: 'cherry'}"
        as="fruit" key="label"
    >
        <li>{label}: {fruit}</li>
    </f:for>
</ul>
Copied!

Output:

<ul>
    <li>fruit1: apple</li>
    <li>fruit2: pear</li>
    <li>fruit3: banana</li>
    <li>fruit4: cherry</li>
</ul>
Copied!

Iteration information 

<ul>
    <f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo" iteration="fooIterator">
        <li>Index: {fooIterator.index} Cycle: {fooIterator.cycle} Total: {fooIterator.total}{f:if(condition: fooIterator.isEven, then: ' Even')}{f:if(condition: fooIterator.isOdd, then: ' Odd')}{f:if(condition: fooIterator.isFirst, then: ' First')}{f:if(condition: fooIterator.isLast, then: ' Last')}</li>
    </f:for>
</ul>
Copied!

Output:

<ul>
    <li>Index: 0 Cycle: 1 Total: 4 Odd First</li>
    <li>Index: 1 Cycle: 2 Total: 4 Even</li>
    <li>Index: 2 Cycle: 3 Total: 4 Odd</li>
    <li>Index: 3 Cycle: 4 Total: 4 Even Last</li>
</ul>
Copied!

Go to the source code of this ViewHelper: ForViewHelper.php (GitHub).

Arguments

The following arguments are available for the for ViewHelper:

as

as
Type
string
Required
1
The name of the iteration variable

each

each
Type
array
Required
1
The array or \SplObjectStorage to iterated over

iteration

iteration
Type
string
The name of the variable to store iteration information (index, cycle, total, isFirst, isLast, isEven, isOdd)

key

key
Type
string
Variable to assign array key to

reverse

reverse
Type
boolean
Default
false
If true, iterates in reverse

GroupedFor ViewHelper <f:groupedFor> 

Grouped loop ViewHelper. Loops through the specified values.

The groupBy argument also supports property paths.

Using this ViewHelper can be a sign of weak architecture. If you end up using it extensively you might want to fine-tune your "view model" (the data you assign to the view).

Examples 

Simple 

<f:groupedFor each="{0: {name: 'apple', color: 'green'}, 1: {name: 'cherry', color: 'red'}, 2: {name: 'banana', color: 'yellow'}, 3: {name: 'strawberry', color: 'red'}}"
    as="fruitsOfThisColor" groupBy="color"
>
    <f:for each="{fruitsOfThisColor}" as="fruit">
        {fruit.name}
    </f:for>
</f:groupedFor>
Copied!

Output:

apple cherry strawberry banana
Copied!

Two dimensional list 

<ul>
    <f:groupedFor each="{0: {name: 'apple', color: 'green'}, 1: {name: 'cherry', color: 'red'}, 2: {name: 'banana', color: 'yellow'}, 3: {name: 'strawberry', color: 'red'}}" as="fruitsOfThisColor" groupBy="color" groupKey="color">
        <li>
            {color} fruits:
            <ul>
                <f:for each="{fruitsOfThisColor}" as="fruit" key="label">
                    <li>{label}: {fruit.name}</li>
                </f:for>
            </ul>
        </li>
    </f:groupedFor>
</ul>
Copied!

Output:

<ul>
    <li>green fruits
        <ul>
            <li>0: apple</li>
        </ul>
    </li>
    <li>red fruits
        <ul>
            <li>1: cherry</li>
        </ul>
        <ul>
            <li>3: strawberry</li>
        </ul>
    </li>
    <li>yellow fruits
        <ul>
            <li>2: banana</li>
        </ul>
    </li>
</ul>
Copied!

Go to the source code of this ViewHelper: GroupedForViewHelper.php (GitHub).

Arguments

The following arguments are available for the groupedFor ViewHelper:

as

as
Type
string
Required
1
The name of the iteration variable

each

each
Type
array
Required
1
The array or \SplObjectStorage to iterated over

groupBy

groupBy
Type
string
Required
1
Group by this property

groupKey

groupKey
Type
string
Default
'groupKey'
The name of the variable to store the current group

If ViewHelper <f:if> 

This ViewHelper implements an if/else condition.

Fluid Boolean Rules / Conditions: 

A condition is evaluated as a boolean value, so you can use any boolean argument, like a variable. Alternatively, you can use a full boolean expression. The entered expression is evaluated as a PHP expression. You can combine multiple expressions via && (logical AND) and || (logical OR).

An expression can also be prepended with the ! ("not") character, which will negate that expression.

Have a look into the Fluid section of the "TYPO3 Explained" Documentation for more details about complex conditions.

Boolean expressions have the following form:

is true variant: {variable}:

<f:if condition="{foo}">
    Will be shown if foo is truthy.
</f:if>
Copied!

or is false variant: !{variable}:

<f:if condition="!{foo}">
    Will be shown if foo is falsy.
</f:if>
Copied!

or comparisons with expressions:

XX Comparator YY
Copied!

Comparator is one of: ==, !=, <, <=, >, >= and % The % operator (modulo) converts the result of the operation to boolean.

XX and YY can be one of:

  • Number
  • String
  • Object Accessor (object.property)
  • Array
  • a ViewHelper
<f:if condition="{rank} > 100">
    Will be shown if rank is > 100
</f:if>
<f:if condition="{rank} % 2">
    Will be shown if rank % 2 != 0.
</f:if>
<f:if condition="{rank} == {k:bar()}">
    Checks if rank is equal to the result of the ViewHelper "k:bar"
</f:if>
<f:if condition="{object.property} == 'stringToCompare'">
    Will result in true if {object.property}'s represented value
    equals 'stringToCompare'.
</f:if>
Copied!

Examples 

Basic usage 

<f:if condition="somecondition">
    This is being shown in case the condition matches
</f:if>
Copied!

Output:

Everything inside the <f:if> tag is being displayed if the condition evaluates to true.
Copied!

If / then / else 

<f:if condition="somecondition">
    <f:then>
        This is being shown in case the condition matches.
    </f:then>
    <f:else>
        This is being displayed in case the condition evaluates to false.
    </f:else>
</f:if>
Copied!

Output:

Everything inside the "then" tag is displayed if the condition evaluates to true.
Otherwise, everything inside the "else" tag is displayed.
Copied!

Inline notation 

{f:if(condition: someCondition, then: 'condition is met', else: 'condition is not met')}
Copied!

Output:

The value of the "then" attribute is displayed if the condition evaluates to true.
Otherwise, everything the value of the "else" attribute is displayed.
Copied!

Combining multiple conditions 

<f:if condition="{user.rank} > 100 && {user.type} == 'contributor'">
    <f:then>
        This is being shown in case both conditions match.
    </f:then>
    <f:else if="{user.rank} > 200 && ({user.type} == 'contributor' || {user.type} == 'developer')">
        This is being displayed in case the first block of the condition evaluates to true and any condition in
        the second condition block evaluates to true.
    </f:else>
    <f:else>
        This is being displayed when none of the above conditions evaluated to true.
    </f:else>
</f:if>
Copied!

Output:

Depending on which expression evaluated to true, that value is displayed.
If no expression matched, the contents inside the final "else" tag are displayed.
Copied!

Go to the source code of this ViewHelper: IfViewHelper.php (GitHub).

Arguments

The following arguments are available for the if ViewHelper:

condition

condition
Type
boolean
Default
false
Condition expression conforming to Fluid boolean rules

else

else
Type
mixed
Value to be returned if the condition if not met.

then

then
Type
mixed
Value to be returned if the condition if met.

Image ViewHelper <f:image> 

Resizes a given image (if required) and renders the respective img tag.

Note that image operations (cropping, scaling, converting) on non-FAL files (i.e. extension resources) may be changed in future TYPO3 versions, since those operations are coupled with FAL metadata. Each non-FAL image operation creates a "fake" FAL record, which may lead to problems.

External URLs are not processed. Only a given width and height will be set on the tag.

Examples 

Default 

<f:image src="EXT:myext/Resources/Public/typo3_logo.png" alt="alt text" />
Copied!

Output in frontend:

<img alt="alt text" src="typo3conf/ext/myext/Resources/Public/typo3_logo.png" width="396" height="375" />
Copied!

or in backend:

<img alt="alt text" src="../typo3conf/ext/viewhelpertest/Resources/Public/typo3_logo.png" width="396" height="375" />
Copied!

Image Object 

<f:image image="{imageObject}" />
Copied!

Output:

<img alt="alt set in image record" src="fileadmin/_processed_/323223424.png" width="396" height="375" />
Copied!

Inline notation 

{f:image(src: 'EXT:viewhelpertest/Resources/Public/typo3_logo.png', alt: 'alt text', minWidth: 30, maxWidth: 40)}
Copied!

Output:

<img alt="alt text" src="../typo3temp/assets/images/f13d79a526.png" width="40" height="38" />
Copied!

Depending on your TYPO3s encryption key.

Other resource type (e.g. PDF) 

<f:image src="fileadmin/user_upload/example.pdf" alt="foo" />
Copied!

If your graphics processing library is set up correctly then it will output a thumbnail of the first page of your PDF document: <img src="fileadmin/_processed_/1/2/csm_example_aabbcc112233.gif" width="200" height="284" alt="foo">

Non-existent image 

<f:image src="NonExistingImage.png" alt="foo" />
Copied!

Could not get image resource for "NonExistingImage.png".

Go to the source code of this ViewHelper: ImageViewHelper.php (GitHub).

Arguments

The following arguments are available for the image ViewHelper:

absolute

absolute
Type
bool
Default
false
Force absolute URL

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

alt

alt
Type
string
Specifies an alternate text for an image

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

crop

crop
Type
string|bool|array
overrule cropping of image (setting to FALSE disables the cropping set in FileReference)

cropVariant

cropVariant
Type
string
Default
'default'
select a cropping variant, in case multiple croppings have been specified or stored in FileReference

data

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

decoding

decoding
Type
string
Provides an image decoding hint to the browser. Can be "sync", "async" or "auto"

dir

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

fileExtension

fileExtension
Type
string
Custom file extension to use

height

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

id

id
Type
string
Unique (in this file) identifier for this HTML element.

image

image
Type
object
a FAL object (\TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference)

ismap

ismap
Type
string
Specifies an image as a server-side image-map. Rarely used. Look at usemap instead

lang

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

loading

loading
Type
string
Native lazy-loading for images property. Can be "lazy", "eager" or "auto"

longdesc

longdesc
Type
string
Specifies the URL to a document that contains a long description of an image

maxHeight

maxHeight
Type
int
maximum height of the image

maxWidth

maxWidth
Type
int
maximum width of the image

minHeight

minHeight
Type
int
minimum height of the image

minWidth

minWidth
Type
int
minimum width of the image

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

src

src
Type
string
Default
''
a path to a file, a combined FAL identifier or an uid (int). If $treatIdAsReference is set, the integer is considered the uid of the sys_file_reference record. If you already got a FAL object, consider using the $image parameter instead

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

treatIdAsReference

treatIdAsReference
Type
bool
Default
false
given src argument is a sys_file_reference record

usemap

usemap
Type
string
Specifies an image as a client-side image-map

width

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

Inline ViewHelper <f:inline> 

Inline Fluid rendering ViewHelper

Renders Fluid code stored in a variable, which you normally would have to render before assigning it to the view. Instead you can do the following (note, extremely simplified use case):

$view->assign('variable', 'value of my variable');
$view->assign('code', 'My variable: {variable}');
Copied!

And in the template:

{code -> f:inline()}
Copied!

Which outputs:

My variable: value of my variable
Copied!

You can use this to pass smaller and dynamic pieces of Fluid code to templates, as an alternative to creating new partial templates.

Go to the source code of this ViewHelper: InlineViewHelper.php (GitHub).

Arguments

The following arguments are available for the inline ViewHelper:

code

code
Type
string
Fluid code to be rendered as if it were part of the template rendering it. Can be passed as inline argument or tag content

Join ViewHelper <f:join> 

The JoinViewHelper combines elements from an array into a single string. You can specify both a general separator and a special one for the last element, which serves as the delimiter between the elements.

Examples 

Simple join 

<f:join value="{0: '1', 1: '2', 2: '3'}" />
Copied!
123
Copied!

Join with separator 

<f:join value="{0: '1', 1: '2', 2: '3'}" separator=", " />
Copied!
1, 2, 3
Copied!

Join with separator, and special one for the last 

<f:join value="{0: '1', 1: '2', 2: '3'}" separator=", " separatorLast=" and " />
Copied!
1, 2 and 3
Copied!

Go to the source code of this ViewHelper: JoinViewHelper.php (GitHub).

Arguments

The following arguments are available for the join ViewHelper:

separator

separator
Type
string
Default
''
The separator

separatorLast

separatorLast
Type
string
The separator for the last pair.

value

value
Type
array
An array

Last ViewHelper <f:last> 

The LastViewHelper returns the last item of an array.

Example 

<f:last value="{0: 'first', 1: 'second'}" />
Copied!
second
Copied!

Go to the source code of this ViewHelper: LastViewHelper.php (GitHub).

Arguments

The following arguments are available for the last ViewHelper:

value

value
Type
array

Layout ViewHelper <f:layout> 

With this tag, you can select a layout to be used for the current template.

Examples 

<f:layout name="main" />
Copied!

Output:

(no output)
Copied!

Go to the source code of this ViewHelper: LayoutViewHelper.php (GitHub).

Arguments

The following arguments are available for the layout ViewHelper:

name

name
Type
string
Name of layout to use. If none given, "Default" is used.

Media ViewHelper <f:media> 

Render a given media file with the correct html tag.

It asks the RendererRegistry 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" />
Copied!

Output:

<img alt="alt set in image record" src="fileadmin/_processed_/323223424.png" width="396" height="375" />
Copied!

MP4 Video Object 

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

Output:

<video width="400" height="375" controls><source src="fileadmin/user_upload/my-video.mp4" type="video/mp4"></video>
Copied!

MP4 Video Object with loop and autoplay option set 

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

Output:

<video width="400" height="375" controls loop><source src="fileadmin/user_upload/my-video.mp4" type="video/mp4"></video>
Copied!

Go to the source code of this ViewHelper: MediaViewHelper.php (GitHub).

Arguments

The following arguments are available for the media ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

additionalConfig

additionalConfig
Type
array
Default
array ( )
This array can hold additional configuration that is passed though to the Renderer object

alt

alt
Type
string
Specifies an alternate text for an image

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

cropVariant

cropVariant
Type
string
Default
'default'
select a cropping variant, in case multiple croppings have been specified or stored in FileReference

data

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

decoding

decoding
Type
string
Provides an image decoding hint to the browser. Can be "sync", "async" or "auto"

dir

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

file

file
Type
object
Required
1
File

fileExtension

fileExtension
Type
string
Custom file extension to use for images

height

height
Type
string
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.

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

loading

loading
Type
string
Native lazy-loading for images property. Can be "lazy", "eager" or "auto". Used on image files only.

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

width

width
Type
string
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.

Or ViewHelper <f:or> 

Or ViewHelper

If content is null use alternative text.

Usage of f:or 

{f:variable(name:'fallback',value:'this is not the variable you\'re looking for')}
{undefinedVariable -> f:or(alternative:fallback)}
Copied!

Usage of ternary operator 

In some cases (e.g. when you want to check for empty instead of null) it might be more handy to use a ternary operator instead of f:or

{emptyVariable ?: 'this is an alterative text'}
Copied!

Go to the source code of this ViewHelper: OrViewHelper.php (GitHub).

Arguments

The following arguments are available for the or ViewHelper:

alternative

alternative
Type
mixed
Alternative if content is null

arguments

arguments
Type
array
Arguments to be replaced in the resulting string, using sprintf

content

content
Type
mixed
Content to check if null

Render ViewHelper <f:render> 

Go to the source code of this ViewHelper: RenderViewHelper.php (GitHub).

Arguments

The following arguments are available for the render ViewHelper:

arguments

arguments
Type
array
Default
array ( )
Array of variables to be transferred. Use {_all} for all variables

contentAs

contentAs
Type
string
If used, renders the child content and adds it as a template variable with this name for use in the partial/section

debug

debug
Type
boolean
Default
true
If true, the admin panel shows debug information if activated,

default

default
Type
mixed
Value (usually string) to be displayed if the section or partial does not exist

delegate

delegate
Type
string
Optional PHP class name of a permanent, included-in-app ParsedTemplateInterface implementation to override partial/section

optional

optional
Type
boolean
Default
false
If true, considers the *section* optional. Partial never is.

partial

partial
Type
string
Partial to render, with or without section

section

section
Type
string
Section to render - combine with partial to render section in partial

Replace ViewHelper <f:replace> 

The ReplaceViewHelper replaces one or multiple strings with other strings. This ViewHelper mimicks PHP's str_replace() function. However, it's also possible to provide replace pairs as associative array via the "replace" argument.

Examples 

Replace a single string 

<f:replace value="Hello World" search="World" replace="Fluid" />
Copied!
Hello Fluid
Copied!

Replace multiple strings 

<f:replace value="Hello World" search="{0: 'World', 1: 'Hello'}" replace="{0: 'Fluid', 1: 'Hi'}" />
Copied!
Hi Fluid
Copied!

Replace multiple strings using associative array 

<f:replace value="Hello World" replace="{'World': 'Fluid', 'Hello': 'Hi'}" />
Copied!
Hi Fluid
Copied!

Go to the source code of this ViewHelper: ReplaceViewHelper.php (GitHub).

Arguments

The following arguments are available for the replace ViewHelper:

replace

replace
Type
mixed
Required
1

search

Type
mixed

value

value
Type
string

Section ViewHelper <f:section> 

A ViewHelper to declare sections in templates for later use with e.g. the f:render ViewHelper.

Examples 

Rendering sections 

<f:section name="someSection">This is a section. {foo}</f:section>
<f:render section="someSection" arguments="{foo: someVariable}" />
Copied!

Output:

the content of the section "someSection". The content of the variable {someVariable} will be available in the partial as {foo}
Copied!

Rendering recursive sections 

<f:section name="mySection">
   <ul>
        <f:for each="{myMenu}" as="menuItem">
             <li>
               {menuItem.text}
               <f:if condition="{menuItem.subItems}">
                   <f:render section="mySection" arguments="{myMenu: menuItem.subItems}" />
               </f:if>
             </li>
        </f:for>
   </ul>
</f:section>
<f:render section="mySection" arguments="{myMenu: menu}" />
Copied!

Output:

<ul>
    <li>menu1
        <ul>
            <li>menu1a</li>
            <li>menu1b</li>
        </ul>
    </li>
[...]
(depending on the value of {menu})
Copied!

Go to the source code of this ViewHelper: SectionViewHelper.php (GitHub).

Arguments

The following arguments are available for the section ViewHelper:

name

name
Type
string
Required
1
Name of the section

Spaceless ViewHelper <f:spaceless> 

Space Removal ViewHelper

Removes redundant spaces between HTML tags while preserving the whitespace that may be inside HTML tags. Trims the final result before output.

Heavily inspired by Twig's corresponding node type.

Usage of f:spaceless 

<f:spaceless>
    <div>
        <div>
            <div>text

    text</div>
        </div>
    </div>
</f:spaceless>
Copied!

Output:

<div><div><div>text

text</div></div></div>
Copied!

Go to the source code of this ViewHelper: SpacelessViewHelper.php (GitHub).

Split ViewHelper <f:split> 

The SplitViewHelper splits a string by the specified separator, which results in an array. The number of values in the resulting array can be limited with the limit parameter, which results in an array where the last item contains the remaining unsplit string.

This ViewHelper mimicks PHP's explode() function.

Examples 

Split with a separator 

<f:split value="1,5,8" separator="," />
Copied!
{0: '1', 1: '5', 2: '8'}
Copied!

Split using tag content as value 

<f:split separator="-">1-5-8</f:split>
Copied!
{0: '1', 1: '5', 2: '8'}
Copied!

Split with a limit 

<f:split value="1,5,8" separator="," limit="2" />
Copied!
{0: '1', 1: '5,8'}
Copied!

Go to the source code of this ViewHelper: SplitViewHelper.php (GitHub).

Arguments

The following arguments are available for the split ViewHelper:

limit

limit
Type
int
Default
9223372036854775807
If limit is positive, a maximum of $limit items will be returned. If limit is negative, all items except for the last $limit items will be returned. 0 will be treated as 1.

separator

separator
Type
string
Required
1
Separator string to explode with

value

value
Type
string
The string to explode

Switch ViewHelper <f:switch> 

Switch ViewHelper which can be used to render content depending on a value or expression. Implements what a basic PHP switch() does.

An optional default case can be specified which is rendered if none of the case conditions matches.

Using this ViewHelper can be a sign of weak architecture. If you end up using it extensively you might want to consider restructuring your controllers/actions and/or use partials and sections. E.g. the above example could be achieved with <f:render partial="title.{person.gender}" /> and the partials "title.male.html", "title.female.html", ... Depending on the scenario this can be easier to extend and possibly contains less duplication.

Examples 

Simple Switch statement 

<f:switch expression="{person.gender}">
    <f:case value="male">Mr.</f:case>
    <f:case value="female">Mrs.</f:case>
    <f:defaultCase>Mr. / Mrs.</f:defaultCase>
</f:switch>
Copied!

Output:

"Mr.", "Mrs." or "Mr. / Mrs." (depending on the value of {person.gender})
Copied!

Go to the source code of this ViewHelper: SwitchViewHelper.php (GitHub).

Arguments

The following arguments are available for the switch ViewHelper:

expression

expression
Type
mixed
Required
1
Expression to switch

Then ViewHelper <f:then> 

f:then only has an effect inside of f:if. See the f:if ViewHelper for documentation.

Go to the source code of this ViewHelper: ThenViewHelper.php (GitHub).

Translate ViewHelper <f:translate> 

Translate a key from locallang. The files are loaded from the folder Resources/Private/Language/.

Examples 

Translate key 

<f:translate key="key1" />
Copied!

Value of key key1 in the current website language. Alternatively id can be used instead of key:

<f:translate id="key1" />
Copied!

This will output the same as above. If both id and key are set, id will take precedence.

Keep HTML tags 

<f:format.raw><f:translate key="htmlKey" /></f:format.raw>
Copied!

Value of key htmlKey in the current website language, no htmlspecialchars() applied.

Translate key from custom locallang file 

<f:translate key="key1" extensionName="MyExt"/>
Copied!

or

<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:key1" />
Copied!

Value of key key1 in the current website language.

Inline notation with arguments and default value 

{f:translate(key: 'someKey', arguments: {0: 'dog', 1: 'fox'}, default: 'default value')}
Copied!

Value of key someKey in the current website language with the given arguments (dog and fox) assigned for the specified %s conversions, using PHP sprintf() notation in the language file:

<trans-unit id="someKey" resname="someKey">
    <source>Some text about a %s and a %s.</source>
</trans-unit>
Copied!

The output will be Some text about a dog and a fox.

If the key someKey is not found in the language file, the output is default value.

As in PHP's sprintf() you can order placeholders ( Second %2$s, first %1$s) or use specific types like A padded number: %'.09d, returning 000000123 for a number passed as 123. See the sprintf PHP Documentation for more information on possible formatting.

Inline notation with extension name 

{f:translate(key: 'someKey', extensionName: 'SomeExtensionName')}
Copied!

Value of key someKey in the current website language. The locallang file of extension "some_extension_name" will be used.

Go to the source code of this ViewHelper: TranslateViewHelper.php (GitHub).

Arguments

The following arguments are available for the translate ViewHelper:

alternativeLanguageKeys

alternativeLanguageKeys
Type
array
Alternative language keys if no translation does exist. Ignored in non-extbase context. Deprecated, will be removed in TYPO3 v13.0

arguments

arguments
Type
array
Arguments to be replaced in the resulting string

default

default
Type
string
If the given locallang key could not be found, this value is used. If this argument is not set, child nodes will be used to render the default

extensionName

extensionName
Type
string
UpperCamelCased extension key (for example BlogExample)

id

id
Type
string
Translation ID. Same as key.

key

key
Type
string
Translation Key

languageKey

languageKey
Type
string
Language key ("da" for example) or "default" to use. Also a Locale object is possible. If empty, use current locale from the request.

Variable ViewHelper <f:variable> 

Variable assigning ViewHelper

Assigns one template variable which will exist also after the ViewHelper is done rendering, i.e. adds template variables.

If you require a variable assignment which does not exist in the template after a piece of Fluid code is rendered, consider using f:alias ViewHelper instead.

Usages:

{f:variable(name: 'myvariable', value: 'some value')}
<f:variable name="myvariable">some value</f:variable>
{oldvariable -> f:format.htmlspecialchars() -> f:variable(name: 'newvariable')}
<f:variable name="myvariable"><f:format.htmlspecialchars>{oldvariable}</f:format.htmlspecialchars></f:variable>
Copied!

Go to the source code of this ViewHelper: VariableViewHelper.php (GitHub).

Arguments

The following arguments are available for the variable ViewHelper:

name

name
Type
string
Required
1
Name of variable to create

value

value
Type
mixed
Value to assign. If not in arguments then taken from tag content

Mfa 

Mfa.ifHasState ViewHelper <be:mfa.ifHasState> 

Check if the given provider for the current user has the requested state set

Go to the source code of this ViewHelper: Mfa\IfHasStateViewHelper.php (GitHub).

Arguments

The following arguments are available for the mfa.ifHasState ViewHelper:

else

else
Type
mixed
Value to be returned if the condition if not met.

provider

provider
Type
TYPO3\CMS\Core\Authentication\Mfa\MfaProviderManifestInterface
Required
1
The provider in question

state

state
Type
string
Required
1
The state to check for (e.g. active or locked)

then

then
Type
mixed
Value to be returned if the condition if met.

Toolbar.attributes ViewHelper <be:toolbar.attributes> 

Builds an attribute string for use in rendered toolbar items

Go to the source code of this ViewHelper: Toolbar\AttributesViewHelper.php (GitHub).

Arguments

The following arguments are available for the toolbar.attributes ViewHelper:

class

class
Type
TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface
Required
1
Class being converted to a string for usage as id attribute

Toolbar.ifHasDropdown ViewHelper <be:toolbar.ifHasDropdown> 

Checks whether a toolbar item provides a dropdown menu

Go to the source code of this ViewHelper: Toolbar\IfHasDropdownViewHelper.php (GitHub).

Arguments

The following arguments are available for the toolbar.ifHasDropdown ViewHelper:

class

class
Type
TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface
Required
1
The toolbar item class to be checked for providing a drop down

else

else
Type
mixed
Value to be returned if the condition if not met.

then

then
Type
mixed
Value to be returned if the condition if met.

TypoScript 

TypoScript.fineDiff ViewHelper <be:typoScript.fineDiff> 

Runs two strings through 'FineDiff' on word level.

Go to the source code of this ViewHelper: TypoScript\FineDiffViewHelper.php (GitHub).

Arguments

The following arguments are available for the typoScript.fineDiff ViewHelper:

from

from
Type
string
Default
''
Required
1
Source string

to

to
Type
string
Default
''
Required
1
Target string

Uri 

Uri.editRecord ViewHelper <be:uri.editRecord> 

Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will pass the uid and table to FormEngine.

The uid must be given as a positive integer. For new records, use the <be:uri.newRecord>.

Examples 

URI to the record-edit action passed to FormEngine:

<be:uri.editRecord uid="42" table="a_table" returnUrl="foo/bar" />
Copied!

/typo3/record/edit?edit[a_table][42]=edit&returnUrl=foo/bar

URI to the edit record action: edit only the fields title and subtitle of page uid=42 and return to foo/bar:

<be:uri.editRecord uid="42" table="pages" fields="title,subtitle" returnUrl="foo/bar" />
Copied!

<a href="/typo3/record/edit&edit[pages][42]=edit&returnUrl=foo/bar&columnsOnly[pages]=title,subtitle">

Go to the source code of this ViewHelper: Uri\EditRecordViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.editRecord ViewHelper:

fields

fields
Type
string
Edit only these fields (comma separated list)

returnUrl

returnUrl
Type
string
Default
''
return to this URL after closing the edit dialog

table

table
Type
string
Required
1
target database table

uid

uid
Type
int
Required
1
uid of record to be edited, 0 for creation

Uri.newRecord ViewHelper <be:uri.newRecord> 

Use this ViewHelper to provide 'create new record' links. The ViewHelper will pass the command to FormEngine.

The table argument is mandatory, it decides what record is to be created.

The pid argument will put the new record on this page, if 0 given it will be placed to the root page.

The uid argument accepts only negative values. If this is given, the new record will be placed (by sorting field) behind the record with the uid. It will end up on the same pid as this given record, so the pid must not be given explicitly by pid argument.

An exception will be thrown, if both uid and pid are given. An exception will be thrown, if the uid argument is not a negative integer.

To edit records, use the <be:uri.editRecord>.

Examples 

Uri to create a new record of a_table after record 17 on the same pid:

<be:uri.newRecord table="a_table" returnUrl="foo/bar" uid="-17"/>
Copied!

/typo3/record/edit?edit[a_table][-17]=new&returnUrl=foo/bar

Uri to create a new record of a_table on root page:

<be:uri.newRecord table="a_table" returnUrl="foo/bar""/>
Copied!

/typo3/record/edit?edit[a_table][]=new&returnUrl=foo/bar

Uri to create a new record of a_table on page 17:

<be:uri.newRecord table="a_table" returnUrl="foo/bar" pid="17"/>
Copied!

/typo3/record/edit?edit[a_table][17]=new&returnUrl=foo/bar

Uri to create a new record of a_table on page 17 with a default value:

<be:uri.newRecord table="a_table" returnUrl="foo/bar" pid="17" defaultValues="{a_table: {a_field: 'value'}}"/>
Copied!

/typo3/record/edit?edit[a_table][17]=new&returnUrl=foo/bar&defVals[a_table][a_field]=value

Go to the source code of this ViewHelper: Uri\NewRecordViewHelper.php (GitHub).

Arguments

The following arguments are available for the uri.newRecord ViewHelper:

defaultValues

defaultValues
Type
array
Default
array ( )
default values for fields of the new record

pid

pid
Type
int
the page id where the record will be created

returnUrl

returnUrl
Type
string
Default
''
return to this URL after closing the edit dialog

table

table
Type
string
Required
1
target database table

uid

uid
Type
int
uid < 0 will insert the record after the given uid

Avatar ViewHelper <be:avatar> 

Render the avatar markup, including the <img> tag, for a given backend user.

Examples 

Default 

<be:avatar backendUser="{user.uid}" size="32" showIcon="true" />
Copied!

Output:

<span class="avatar">
    <span class="avatar-image">
        <img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/avatar/svgs/avatar-default.svg" width="32" height="32" alt="" />
    </span>
</span>
Copied!

If the given backend user hasn't added a custom avatar yet, a default one is used.

Inline notation 

{be:avatar(backendUser: user.id, size: 32, showIcon: 'true')}
Copied!

Output:

<span class="avatar">
    <span class="avatar-image">
        <img src="/fileadmin/_processed_/7/9/csm_custom-avatar_4ea4a18f58.jpg" width="32" height="32" alt="" />
    </span>
</span>
Copied!

Go to the source code of this ViewHelper: AvatarViewHelper.php (GitHub).

Arguments

The following arguments are available for the avatar ViewHelper:

backendUser

backendUser
Type
int
Default
0
uid of the backend user

showIcon

showIcon
Type
bool
Default
false
show the record icon as well

size

size
Type
int
Default
32
width and height of the image

LanguageColumn ViewHelper <be:languageColumn> 

Go to the source code of this ViewHelper: LanguageColumnViewHelper.php (GitHub).

Arguments

The following arguments are available for the languageColumn ViewHelper:

columnNumber

columnNumber
Type
int
Required
1
Number (colPos) of column within LanguageColumn to be returned

languageColumn

languageColumn
Type
TYPO3\CMS\Backend\View\BackendLayout\Grid\LanguageColumn
Required
1
Language column object which is context for column

Thumbnail ViewHelper <be:thumbnail> 

ViewHelper for the backend which generates an <img> tag with the special URI to render thumbnails deferred.

Examples 

Default 

<be:thumbnail image="{file.resource}" width="{thumbnail.width}" height="{thumbnail.height}" />
Copied!

Output:

<img src="/typo3/thumbnails?token=&parameters={"fileId":1,"configuration":{"_context":"Image.Preview","maxWidth":64,"maxHeight":64}}&hmac="
     width="64"
     height="64"
     alt="alt set in image record"
     title="title set in image record"/>
Copied!

Inline notation 

{be:thumbnail(image: file.resource, maxWidth: thumbnail.width, maxHeight: thumbnail.height)}
Copied!

Output:

<img src="/typo3/thumbnails?token=&parameters={"fileId":1,"configuration":{"_context":"Image.Preview","maxWidth":64,"maxHeight":64}}&hmac="
     width="64"
     height="64"
     alt="alt set in image record"
     title="title set in image record"/>
Copied!

Go to the source code of this ViewHelper: ThumbnailViewHelper.php (GitHub).

Arguments

The following arguments are available for the thumbnail ViewHelper:

absolute

absolute
Type
bool
Default
false
Force absolute URL

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

alt

alt
Type
string
Specifies an alternate text for an image

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

context

context
Type
string
Default
'Image.Preview'
context for image rendering

crop

crop
Type
string|bool
overrule cropping of image (setting to FALSE disables the cropping set in FileReference)

cropVariant

cropVariant
Type
string
Default
'default'
select a cropping variant, in case multiple croppings have been specified or stored in FileReference

data

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

decoding

decoding
Type
string
Provides an image decoding hint to the browser. Can be "sync", "async" or "auto"

dir

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

fileExtension

fileExtension
Type
string
Custom file extension to use

height

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

id

id
Type
string
Unique (in this file) identifier for this HTML element.

image

image
Type
object
a FAL object (\TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference)

ismap

ismap
Type
string
Specifies an image as a server-side image-map. Rarely used. Look at usemap instead

lang

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

loading

loading
Type
string
Native lazy-loading for images property. Can be "lazy", "eager" or "auto"

maxHeight

maxHeight
Type
int
maximum height of the image

maxWidth

maxWidth
Type
int
maximum width of the image

minHeight

minHeight
Type
int
minimum height of the image

minWidth

minWidth
Type
int
minimum width of the image

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

src

src
Type
string
Default
''
a path to a file, a combined FAL identifier or an uid (int). If $treatIdAsReference is set, the integer is considered the uid of the sys_file_reference record. If you already got a FAL object, consider using the $image parameter instead

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

treatIdAsReference

treatIdAsReference
Type
bool
Default
false
given src argument is a sys_file_reference record

usemap

usemap
Type
string
Specifies an image as a client-side image-map

width

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

Icon ViewHelper <core:icon> 

Displays icon identified by icon identifier.

Examples 

Default:

<core:icon title="Open actions menu" identifier="actions-menu" />
Copied!

Output:

<span title="Open actions menu" class="t3js-icon icon icon-size-small icon-state-default icon-actions-menu" data-identifier="actions-menu" aria-hidden="true">
    <span class="icon-markup">
        <img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/actions/actions-menu.svg" width="16" height="16">
    </span>
</span>
Copied!

Inline:

<core:icon identifier="actions-menu" alternativeMarkupIdentifier="inline" />
Copied!

Output:

<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-menu" data-identifier="actions-menu" aria-hidden="true">
    <span class="icon-markup">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g class="icon-color"><path d="M9 12v2H7v-2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM9 7v2H7V7h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM9 2v2H7V2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM4 7v2H2V7h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM4 2v2H2V2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM4 12v2H2v-2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM14 7v2h-2V7h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM14 2v2h-2V2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5zM14 12v2h-2v-2h2m.5-1h-3c-.3 0-.5.2-.5.5v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5z"/></g></svg>
    </span>
</span>
Copied!

Go to the source code of this ViewHelper: IconViewHelper.php (GitHub).

Arguments

The following arguments are available for the icon ViewHelper:

alternativeMarkupIdentifier

alternativeMarkupIdentifier
Type
string
Alternative icon identifier. Takes precedence over the identifier if supported by the IconProvider.

identifier

identifier
Type
string
Required
1
Identifier of the icon as registered in the Icon Registry.

overlay

overlay
Type
string
Identifier of an overlay icon as registered in the Icon Registry.

size

size
Type
string
Default
'small'
Desired size of the icon. All values of the Icons.sizes enum are allowed, these are: "small", "default", "large" and "overlay".

state

state
Type
string
Default
'default'
Sets the state of the icon. All values of the Icons.states enum are allowed, these are: "default" and "disabled".

title

title
Type
string
Title for the icon

IconForRecord ViewHelper <core:iconForRecord> 

Displays icon for record.

Examples 

Default:

<core:iconForRecord table="tt_content" row="{record}" />
Copied!

Output:

<span class="t3js-icon icon icon-size-small icon-state-default icon-mimetypes-x-content-text" data-identifier="mimetypes-x-content-text" aria-hidden="true">
    <span class="icon-markup">
        <img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/mimetypes/mimetypes-x-content-text.svg" width="16" height="16">
    </span>
</span>
Copied!

Go to the source code of this ViewHelper: IconForRecordViewHelper.php (GitHub).

Arguments

The following arguments are available for the iconForRecord ViewHelper:

alternativeMarkupIdentifier

alternativeMarkupIdentifier
Type
string
alternative markup identifier

row

row
Type
array
Required
1
the record row

size

size
Type
string
Default
'small'
the icon size

table

table
Type
string
Required
1
the table for the record icon

IconForResource ViewHelper <core:iconForResource> 

Displays icon for a FAL resource (file or folder means a \TYPO3\CMS\Core\Resource\ResourceInterface ).

Examples 

Default:

<core:iconForResource resource="{file.resource}" />
Copied!

Output:

<span class="t3js-icon icon icon-size-small icon-state-default icon-mimetypes-text-html" data-identifier="mimetypes-text-html">
    <span class="icon-markup">
        <img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/mimetypes/mimetypes-text-html.svg" width="16" height="16">
    </span>
</span>
Copied!

Go to the source code of this ViewHelper: IconForResourceViewHelper.php (GitHub).

Arguments

The following arguments are available for the iconForResource ViewHelper:

alternativeMarkupIdentifier

alternativeMarkupIdentifier
Type
string
Alternative markup identifier

options

options
Type
array
Default
array ( )
An associative array with additional options

overlay

overlay
Type
string
Overlay identifier

resource

resource
Type
TYPO3\CMS\Core\Resource\ResourceInterface
Required
1
Resource

size

size
Type
string
Default
'small'
The icon size

NormalizedUrl ViewHelper <core:normalizedUrl> 

Normalizes a path that uses EXT: syntax or an absolute URL to an absolute web path

Examples 

Url:

<core:normalizedUrl pathOrUrl="https://foo.bar/img.jpg" />
Copied!

Output:

https://foo.bar/img.jpg
Copied!

Path:

<core:normalizedUrl pathOrUrl="EXT:core/Resources/Public/Images/typo3_black.svg" />
Copied!

Output:

/typo3/sysext/core/Resources/Public/Images/typo3_black.svg
Copied!

Go to the source code of this ViewHelper: NormalizedUrlViewHelper.php (GitHub).

Arguments

The following arguments are available for the normalizedUrl ViewHelper:

pathOrUrl

pathOrUrl
Type
string
Absolute path to file using EXT: syntax or URL.

Form (formvh:*) 

Be.maximumFileSize ViewHelper <formvh:be.maximumFileSize> 

Return the max file size for use in the form editor

Scope: backend

Go to the source code of this ViewHelper: Be\MaximumFileSizeViewHelper.php (GitHub).

Be.renderContentElementPreview ViewHelper <formvh:be.renderContentElementPreview> 

Used by the form editor. Render a content element preview like the page module

Scope: backend

Go to the source code of this ViewHelper: Be\RenderContentElementPreviewViewHelper.php (GitHub).

Arguments

The following arguments are available for the be.renderContentElementPreview ViewHelper:

contentElementUid

contentElementUid
Type
int
The uid of a content element

Form.datePicker ViewHelper <formvh:form.datePicker> 

Display a jQuery date picker.

Note: Requires jQuery UI to be included on the page.

Scope: frontend

Go to the source code of this ViewHelper: Form\DatePickerViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.datePicker ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dateFormat

dateFormat
Type
string
Default
'Y-m-d'
The date format

datePickerInitializationJavaScriptFile

datePickerInitializationJavaScriptFile
Type
string
Default
'EXT:form/Resources/Public/JavaScript/frontend/date-picker.js'
The JavaScript file to initialize the date picker

dir

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

enableDatePicker

enableDatePicker
Type
bool
Default
true
Enable the Datepicker

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

initialDate

initialDate
Type
string
Initial date (@see http://www.php.net/manual/en/datetime.formats.php for supported formats)

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

placeholder

placeholder
Type
string
Specifies a short hint that describes the expected value of an input element

previewMode

previewMode
Type
bool
Default
false
Required
1
Preview mde flag

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

size

size
Type
int
The size of the input field

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.timePicker ViewHelper <formvh:form.timePicker> 

Displays two select-boxes for hour and minute selection.

Scope: frontend

Go to the source code of this ViewHelper: Form\TimePickerViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.timePicker ViewHelper:

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the select element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

initialDate

initialDate
Type
string
Initial time (@see http://www.php.net/manual/en/datetime.formats.php for supported formats)

lang

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

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

placeholder

placeholder
Type
string
Specifies a short hint that describes the expected value of an input element

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

size

size
Type
int
The size of the select field

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

timeType

timeType
Type
string
"hour" or "minute"

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form.uploadedResource ViewHelper <formvh:form.uploadedResource> 

This ViewHelper makes the specified Image object available for its childNodes. In case the form is redisplayed because of validation errors, a previously uploaded image will be correctly used.

Scope: frontend

Go to the source code of this ViewHelper: Form\UploadedResourceViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.uploadedResource ViewHelper:

accept

accept
Type
array
Default
array ( )
Values for the accept attribute

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

additionalAttributes

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

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

as

as
Type
string

class

class
Type
string
CSS class(es) for this element

data

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

dir

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

disabled

disabled
Type
string
Specifies that the input element should be disabled when the page loads

errorClass

errorClass
Type
string
Default
'f3-form-error'
CSS class to set if there are errors for this ViewHelper

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

multiple

multiple
Type
string
Specifies that the file input element should allow multiple selection of files

name

name
Type
string
Name of input tag

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

title

title
Type
string
Tooltip text of element

value

value
Type
mixed
Value of input tag

Form ViewHelper <formvh:form> 

Custom form ViewHelper that renders the form state instead of referrer fields

Scope: frontend

Go to the source code of this ViewHelper: FormViewHelper.php (GitHub).

Arguments

The following arguments are available for the form ViewHelper:

absolute

absolute
Type
bool
Default
false
If set, an absolute action URI is rendered (only active if $actionUri is not set)

accesskey

accesskey
Type
string
Keyboard shortcut to access this element

action

action
Type
string
Target action

actionUri

actionUri
Type
string
can be used to overwrite the "action" attribute of the form tag

addQueryString

addQueryString
Type
string
Default
false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.

additionalAttributes

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

additionalParams

additionalParams
Type
array
Default
array ( )
additional action URI query parameters that won't be prefixed like $arguments (overrule $arguments) (only active if $actionUri is not set)

arguments

arguments
Type
array
Default
array ( )
Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)

argumentsToBeExcludedFromQueryString

argumentsToBeExcludedFromQueryString
Type
array
Default
array ( )
arguments to be removed from the action URI. Only active if $addQueryString = TRUE and $actionUri is not set

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

class

class
Type
string
CSS class(es) for this element

controller

controller
Type
string
Target controller

data

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

dir

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

enctype

enctype
Type
string
MIME type with which the form is submitted

extensionName

extensionName
Type
string
Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used

fieldNamePrefix

fieldNamePrefix
Type
string
Prefix that will be added to all field names within this form. If not set the prefix will be tx_yourExtension_plugin

format

format
Type
string
Default
''
The requested format (e.g. ".html") of the target page (only active if $actionUri is not set)

hiddenFieldClassName

hiddenFieldClassName
Type
string
hiddenFieldClassName

id

id
Type
string
Unique (in this file) identifier for this HTML element.

lang

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

method

method
Type
string
Default
'post'
Transfer type (get or post)

name

name
Type
string
Name of form

noCache

noCache
Type
bool
Default
false
set this to disable caching for the target page. You should not need this.

novalidate

novalidate
Type
bool
Indicate that the form is not to be validated on submit.

object

object
Type
mixed
Object to use for the form. Use in conjunction with the "property" attribute on the sub tags

objectName

objectName
Type
string
name of the object that is bound to this form. If this argument is not specified, the name attribute of this form is used to determine the FormObjectName

onclick

onclick
Type
string
JavaScript evaluated for the onclick event

onreset

onreset
Type
string
JavaScript: On reset of the form

onsubmit

onsubmit
Type
string
JavaScript: On submit of the form

pageType

pageType
Type
int
Default
0
Target page type

pageUid

pageUid
Type
int
Target page uid

pluginName

pluginName
Type
string
Target plugin. If empty, the current plugin name is used

requestToken

requestToken
Type
mixed
whether to add that request token to the form

section

section
Type
string
Default
''
The anchor to be added to the action URI (only active if $actionUri is not set)

signingType

signingType
Type
string
which signing type to be used on the request token (falls back to "nonce")

style

style
Type
string
Individual CSS styles for this element

tabindex

tabindex
Type
integer
Specifies the tab order of this element

target

target
Type
string
Target attribute of the form

title

title
Type
string
Tooltip text of element

GridColumnClassAutoConfiguration ViewHelper <formvh:gridColumnClassAutoConfiguration> 

Scope: frontend

Go to the source code of this ViewHelper: GridColumnClassAutoConfigurationViewHelper.php (GitHub).

Arguments

The following arguments are available for the gridColumnClassAutoConfiguration ViewHelper:

element

element
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Required
1
A RootRenderableInterface instance

Render ViewHelper <formvh:render> 

Main Entry Point to render a Form into a Fluid Template

Usage 

Default:

{namespace formvh=TYPO3\CMS\Form\ViewHelpers}
<formvh:render factoryClass="NameOfYourCustomFactoryClass" />
Copied!

The factory class must implement \TYPO3\CMS\Form\Domain\Factory\FormFactoryInterface .

Scope: frontend

Go to the source code of this ViewHelper: RenderViewHelper.php (GitHub).

Arguments

The following arguments are available for the render ViewHelper:

factoryClass

factoryClass
Type
string
Default
'TYPO3\\CMS\\Form\\Domain\\Factory\\ArrayFormFactory'
The fully qualified class name of the factory

overrideConfiguration

overrideConfiguration
Type
array
Default
array ( )
factory specific configuration

persistenceIdentifier

persistenceIdentifier
Type
string
The persistence identifier for the form.

prototypeName

prototypeName
Type
string
Name of the prototype to use

RenderAllFormValues ViewHelper <formvh:renderAllFormValues> 

Renders the values of a form

Scope: frontend

Go to the source code of this ViewHelper: RenderAllFormValuesViewHelper.php (GitHub).

Arguments

The following arguments are available for the renderAllFormValues ViewHelper:

as

as
Type
string
Default
'formValue'
The name within the template

renderable

renderable
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Required
1
A RootRenderableInterface instance

RenderFormValue ViewHelper <formvh:renderFormValue> 

Renders a single value of a form

Scope: frontend

Go to the source code of this ViewHelper: RenderFormValueViewHelper.php (GitHub).

Arguments

The following arguments are available for the renderFormValue ViewHelper:

as

as
Type
string
Default
'formValue'
The name within the template

renderable

renderable
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface
Required
1
A renderable element

RenderRenderable ViewHelper <formvh:renderRenderable> 

Render a renderable.

Set the renderable into the TYPO3CMSFormMvcViewFormView and return the rendered content.

Scope: frontend

Go to the source code of this ViewHelper: RenderRenderableViewHelper.php (GitHub).

Arguments

The following arguments are available for the renderRenderable ViewHelper:

renderable

renderable
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Required
1
A RenderableInterface instance

TranslateElementError ViewHelper <formvh:translateElementError> 

Translate form element properties.

Scope: frontend / backend

Go to the source code of this ViewHelper: TranslateElementErrorViewHelper.php (GitHub).

Arguments

The following arguments are available for the translateElementError ViewHelper:

element

element
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Required
1
Form Element to translate

error

error
Type
TYPO3\CMS\Extbase\Error\Error
Required
1
Error

TranslateElementProperty ViewHelper <formvh:translateElementProperty> 

Translate form element properties.

Scope: frontend / backend

Go to the source code of this ViewHelper: TranslateElementPropertyViewHelper.php (GitHub).

Arguments

The following arguments are available for the translateElementProperty ViewHelper:

element

element
Type
TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Required
1
Form Element to translate

property

property
Type
mixed
Property to translate

renderingOptionProperty

renderingOptionProperty
Type
mixed
Property to translate

Contribution 

Unlike most official TYPO3 documentation, this manual does not support the popular Edit on GitHub workflow for manual contributions, as these documentation files are automatically generated from the ViewHelper source files - and overwritten on each generation run.

Therefore, contribute to this documentation by editing the appropriate source files at

  1. https://github.com/TYPO3/typo3/tree/main/typo3/sysext/core/Classes/ViewHelpers
  2. https://github.com/TYPO3/typo3/tree/main/typo3/sysext/backend/Classes/ViewHelpers
  3. https://github.com/TYPO3/typo3/tree/main/typo3/sysext/fluid/Classes/ViewHelpers
  4. https://github.com/TYPO3/Fluid/tree/main/src/ViewHelpers

For example, adding a new code sample to the format.number page at

is done by editing the class comment in

To enrich the comment text you can use the common directives of the reST markup language supported by the TYPO3 documentation rendering toolchain.

Sitemap