From 5f539df95413cf478677f7d5fa0b524232e6f0cb Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Tue, 12 Jul 2022 17:21:57 +0200 Subject: [PATCH] [TASK] Add ViewHelpers to Fluid syntax Part of the text has been reused from the Extbase book. In subsequent patches, more content will be migrated from the Extbase book to TYPO3 Explained. Related: TYPO3-Documentation/TYPO3CMS-Book-ExtbaseFluid#536 --- Documentation/ApiOverview/Fluid/Syntax.rst | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/Documentation/ApiOverview/Fluid/Syntax.rst b/Documentation/ApiOverview/Fluid/Syntax.rst index 836952f318..08b557ef5a 100644 --- a/Documentation/ApiOverview/Fluid/Syntax.rst +++ b/Documentation/ApiOverview/Fluid/Syntax.rst @@ -71,14 +71,56 @@ It is possible to access array or object values by a dynamic index: myArray.{myIndex} -ViewHelper attributes -===================== +ViewHelpers +=========== + +ViewHelpers are special tags in the template which provide more complex +functionality such as loops or generating links. + +The functionality of the ViewHelper is implemented in PHP, every ViewHelper has +its own PHP class. + +Within Fluid, the ViewHelper is used as a special HTML element with a namespace +prefix, for example the namespace prefix "f" is used for ViewHelpers from the +Fluid namespace: + +.. code-block:: html + :caption: Fluid example with for ViewHelper + + + +
  • {result.title}
  • +
    + + +The "f" namespace is already defined, but can be explicitly specified to +improve IDE autocompletion. + +If the attribute :html:`data-namespace-typo3-fluid="true"` is specified on the +:html:`html` element, the HTML element itself won’t be rendered +This is useful for various IDEs and HTML auto-completion. + +.. code-block:: html + :caption: Fluid example with custom ViewHelper "custom" in namespace "my" + + + + See the :doc:`Fluid Viewhelper Reference ` for a complete list of all available ViewHelpers. +Viewhelper attributes +--------------------- + Simple ------- +~~~~~~ Variables can be inserted into ViewHelper attributes by putting them in curly braces: