` ViewHelper with default arguments
=============================================================
.. code-block:: html
{$myConstant.project} is a cool CMS
(TYPO3).
.. code-block:: html
TYPO3 is a cool CMS
(TYPO3).
The exact output depends on TYPO3 constants.
.. _typo3-fluid-format-html-arguments:
Arguments of the `` ViewHelper
=============================================
.. typo3:viewhelper:: format.html
:source: ../../Global.json
:display: arguments-only
.. _typo3-fluid-format-html-parseFunc:
parseFuncTSPath argument: formatting text with a custom parsing function
------------------------------------------------------------------------
The `parseFuncTSPath` argument specifies which TypoScript `parseFunc`
configuration is used to process the content.
.. code-block:: html
{someText}
or inline:
.. code-block:: html
{someText -> f:format.html(parseFuncTSPath: 'lib.myParseFunc')}
With a custom parsing function defined in TypoScript:
.. code-block:: typoscript
:caption: config/site/mysite/setup.typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
// replace --- with soft-hyphen
short.--- =
}
.. seealso::
For all options see the
`TypoScript reference, chapter parseFunc `_.
.. _typo3-fluid-format-html-arguments-data:
Data argument
-------------
.. versionchanged:: 14.0
The `Render.text ViewHelper `_
should be used whenever text fields from records are
displayed in HTML output.
Depending on the TCA definition of the rendered field `nl2br` is then
automatically applied for multi line text areas.
If you use TypoScript properties such as :typoscript:`field` or :typoscript:`dataWrap`,
you should pass structured data
(`Data transfer object (DTO) `_
or named array) as `data`. This ensures that field references like
`{FIELD:title}` are resolved correctly.
.. code-block:: html
You entered the following in the form:
You may get the following output:
.. code-block:: html
You entered the following in the form:
TYPO3, greatest CMS ever
With a custom parsing function defined in TypoScript:
.. code-block:: typoscript
:caption: config/site/mysite/setup.typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
dataWrap = |{FIELD:title}
}
.. _typo3-fluid-format-html-arguments-data-current:
Current argument
-----------------
Use the `current` argument to override the current value used by the TypoScript
content object.
.. code-block:: html
I'm gone
You may get the following output:
.. code-block:: html
Thanks Kasper for this great CMS
With the following custom parsing function defined in TypoScript:
.. code-block:: typoscript
:caption: config/site/mysite/setup.typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
setContentToCurrent = 1
}
.. _typo3-fluid-format-html-arguments-data-CurrentValueKey:
CurrentValueKey argument
-------------------------
Use the `currentValueKey` argument to define a value of data object as the
current value.
.. code-block:: html
Content:
You may get the following output:
.. code-block:: html
Content: How to install TYPO3 in under 2 minutes ;-)
With the following custom parsing function defined in TypoScript:
.. code-block:: typoscript
:caption: config/site/mysite/setup.typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
dataWrap = |{CURRENT:1}
}