Display Fluid ViewHelpers in ReStructuredText

The special .. typo3:viewhelper:: directive can be used to display the information about a Fluid ViewHelper, including all arguments.

The information on the available arguments is included from a .json file. See also https://github.com/TYPO3-Documentation/fluid-documentation-generator on how to generate the input file.

Example: Display a ViewHelper from a JSON include

Documentation/MyViewHelper.rst
..  typo3:viewhelper:: link.external
    :source: /resources/global_viewhelpers_demo.json
Copied!
Documentation/resources/global_viewhelpers_demo.json

{
  "namespace": "http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers",
  "viewHelpers": {
    "split": {
      "className": "TYPO3Fluid\\Fluid\\ViewHelpers\\SplitViewHelper",
      "...": "..."
    },
    "link.external":{
      "className": "TYPO3\\CMS\\Fluid\\ViewHelpers\\Link\\ExternalViewHelper",
      "namespace": "TYPO3\\CMS\\Fluid\\ViewHelpers",
      "name": "Link\\ExternalViewHelper",
      "tagName": "link.external",
      "documentation": "A ViewHelper for creating links to external targets.\n\nExamples\n========\n...",
      "xmlNamespace": "http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers",
      "docTags": {},
      "argumentDefinitions": {
        "uri": {
          "name": "uri",
          "type": "string",
          "description": "The URI that will be put in the href attribute of the rendered link tag",
          "required": true,
          "defaultValue": null,
          "escape": null
        }
      },
      "allowsArbitraryArguments": true
    },
    "...": "..."
  }
}
Copied!

Properties of the viewhelper directive

Name Type
string
string, local file path, relative or absolute
string
bool

[content]

[content]
Type
string

Name of the ViewHelper as used as key in the the JSON include file.

:source:

:source:
Type
string, local file path, relative or absolute

Path to the source JSON file to be included. Can be relative or absolute.

..  viewhelper:: my.viewhelper
    :source: /some/absolute/path/_includes/_my_viewhelper.json

..  viewhelper:: my.viewhelper
    :source: ../_includes/_my_viewhelper.json
Copied!

The path is calculated starting from the Documentation directory. It is not possible to include files from different locations in an extension.

:sortBy:

:sortBy:
Type
string
Default
name

Ordering of the argument list.

name
Sort the arguments alphabetically by name
json
Sort the arguments in the order they appear in the JSON file.
..  typo3:viewhelper:: split
    :source: resources/global_viewhelpers_demo.json
    :sortBy: name

..  typo3:viewhelper:: image
    :source: resources/global_viewhelpers_demo.json
    :sortBy: json
Copied!

:noindex:

:noindex:
Type
bool

If set the ViewHelper will only be displayed but cannot be linked and is not added to any indexes. This is useful if the same ViewHelper should be displayed in several places within the same document. In such a case there would be a clash of identifiers and warnings in the rendering if :noindex: is not set.