../_images/logo_typotonic10.jpg

ViewHelpers

All ViewHelpers are available through the namespace t: | The namespace is automatically active, when TypoTonic is installed.

You can surround your templates with the following code, to support autocompletion in your IDE.

<html
    lang="en"
    data-namespace-typo3-fluid="true"
    xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
    xmlns:t="http://typo3.org/ns/Aix/Tonic/ViewHelpers">

    ...Your Code here...

</html>

ViewHelpers\Template\RenderViewHelper

This ViewHelper renders template files, either defined in the plugin TypoScript or a manual file path.

Argument Type Description
template string Please enter a valid file or a template identifier, configured in TypoScript plugin.tx_tonic.templates
arguments array The arguments that will be included in the template
variables array Ids of additional template variables to inject
cache boolean Enable or disable caching of the output
lifetime int Sets the cache lifetime for the cache in seconds
cacheIdentifier string Custom cache identifier

Usage:

<!-- Inline Notation @see https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/8-Fluid/1a-inline-syntax.html -->
{t:template.render(template:'movieMini',arguments:'{record:record}')}

<!-- Basic Notation -->
<t:template.render template="movieMini" arguments="{record:record}" variables="{0:12,1:35}" />
<t:template.render template="fileadmin/templates/tonic/movies/mini.html" arguments="{record:record}" />

ViewHelpers\Datatype\GetViewHelper

Fetch a datatype by uid

Argument Type Description
uid int The Uid of the datatype
onlyEnabled boolean Fetch only and enabled datatype

Returns: Aix\Tonic\Domain\Model\Datatype

Usage:

<!-- Inline Notation -->
{t:datatype.get(id:'1',onlyEnabled:'0')}

<!-- Basic Notation -->
<t:datatype.get uid="1" onlyEnabled="0" />

ViewHelpers\Record\GetViewHelper

Fetch a record by uid

Argument Type Description
uid int The Uid of the datatype
datatype AixTonicDomainModelDatatype Fetch only and enabled datatype
onlyEnabled boolean Fetch only and enabled datatype

Returns: Aix\Tonic\Domain\Model\AbstractRecordModel

Usage:

<!-- Inline Notation -->
{t:record.get(id:'1',datatype:datatype,onlyEnabled:'0')}

<!-- Basic Notation -->
<t:record.get uid="1" datatype="{datatype}" onlyEnabled="0" />

ViewHelpers\Uri\RecordViewHelper

This ViewHelper creates a url-link to a record. The Detail Page Id is normally configured in the Plugin itself and is delivered through {detailPid}.

For all additional link parameters, refer to f:uri.page.

<!-- Inline Notation -->
{t:uri.record(record:record,pageUid:detailPid)}

<!-- Basic Notation -->
<t:uri.record record="{record}" pageUid="{detailPid}" />

ViewHelpers\Filter\RecordsViewHelper

The filter records ViewHelper can add subqueries to the records query-result, that is injected to your templates. You can manually add additional filters to created dynamic results within fluid templates.

A filter contains multiple information like the following table shows

Basic filtering setup

Key Value Type Description / Values
condition string AND / OR
filters array Array with filters

Filter

Key Value Type Description / Values
field string The field name to filter
operator string The filter operator see the Operators table
value mixed The value to search for

Operators

Operator Value Operator SQL
equal =
not_equal !=
in IN
not_in NOT IN
less <
less_or_equal <=
greater >
greater_or_equal >=
between BETWEEN
begins_with LIKE 'xyz%'
not_begins_with NOT LIKE 'xyz%'
contains LIKE '%xyz%'
not_contains NOT LIKE '%xyz%'
ends_with LIKE '%xyz'
not_ends_with NOT LIKE '%xyz'
is_empty = ''
is_not_empty != ''
is_null NULL
is_not_null NOT NULL
<!-- Inline Notation -->
{t:filter.records(records:records,filters:{condition:'AND',rules:{0:{field:'title',operator:'contains',value:'sales'}}})}

<!-- Basic Notation -->
<t:filter.records records="{records}" filters="{condition:'AND',rules:{0:{field:'title',operator:'contains',value:'sales'}}}" />

ViewHelpers\Group\RecordsByPropertyViewHelper

This ViewHelper re-groups given records by a custom property value. It creates an multidimensional array as return value, grouped by the property value of which the property name was given.

<!-- Inline Notation -->
{t:group.recordsByProperty(records:records,property:'propertyName')}

<!-- Basic Notation -->
<t:group.records records="{records}" property="propertyName" />