.. include:: ../Includes.txt
.. _viewhelpers:
.. image:: ../Images/logo_typotonic.jpg
:width: 250px
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.
.. code-block:: html
...Your Code here...
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:
.. code-block:: html
{t:template.render(template:'movieMini',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:
.. code-block:: html
{t:datatype.get(id:'1',onlyEnabled:'0')}
ViewHelpers\\Record\\GetViewHelper
##################################
Fetch a record by uid
+---------------------+-----------------------------------+---------------------------------------------------------+
| Argument | Type | Description |
+=====================+===================================+=========================================================+
| uid | int | The Uid of the datatype |
+---------------------+-----------------------------------+---------------------------------------------------------+
| datatype | Aix\Tonic\Domain\Model\Datatype | Fetch only and enabled datatype |
+---------------------+-----------------------------------+---------------------------------------------------------+
| onlyEnabled | boolean | Fetch only and enabled datatype |
+---------------------+-----------------------------------+---------------------------------------------------------+
Returns: ``Aix\Tonic\Domain\Model\AbstractRecordModel``
Usage:
.. code-block:: html
{t:record.get(id:'1',datatype:datatype,onlyEnabled:'0')}
ViewHelpers\\Link\\RecordViewHelper
###################################
This ViewHelper can create a html link tag with a record parameter and a detail page id.
The Detail Page Id is normally configured in the Plugin itself and is delivered through ``{detailPid}``.
For all additional link parameters, refer to `f:link.page
`_.
.. code-block:: html
Link
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
`_.
.. code-block:: html
{t:uri.record(record:record,pageUid:detailPid)}