-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Document the viewhelper directive (#441)
- Loading branch information
Showing
6 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
Documentation/WritingReST/Reference/Content/ViewHelper.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
:navigation-title: ViewHelper | ||
.. include:: /Includes.rst.txt | ||
.. _viewhelper: | ||
|
||
============================================= | ||
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. | ||
|
||
.. warning:: | ||
Usage of the viewhelper directive outside of the | ||
:ref:`Fluid ViewHelper Reference <t3viewhelper:start>` is still considered | ||
experimental. | ||
|
||
.. _viewhelper-example: | ||
|
||
Example: Display a ViewHelper from a JSON include | ||
================================================= | ||
|
||
.. code-block:: rst | ||
:caption: Documentation/MyViewHelper.rst | ||
.. typo3:viewhelper:: link.external | ||
:source: /resources/global_viewhelpers_demo.json | ||
.. literalinclude:: _ViewHelper/_global_viewhelpers_demo.json | ||
:language: json | ||
:caption: Documentation/resources/global_viewhelpers_demo.json | ||
|
||
|
||
.. _viewhelper-properties: | ||
|
||
Properties of the `viewhelper` directive | ||
======================================== | ||
|
||
.. confval-menu:: | ||
:display: table | ||
:type: | ||
|
||
.. include:: _ViewHelper/_Content.rst.txt | ||
:show-buttons: | ||
|
||
.. include:: _ViewHelper/_Source.rst.txt | ||
:show-buttons: | ||
|
||
.. include:: _ViewHelper/_SortBy.rst.txt | ||
:show-buttons: | ||
|
||
.. include:: _ViewHelper/_NoIndex.rst.txt | ||
:show-buttons: |
5 changes: 5 additions & 0 deletions
5
Documentation/WritingReST/Reference/Content/_ViewHelper/_Content.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.. confval:: [content] | ||
:name: directive-viewhelper-content | ||
:type: string | ||
|
||
Name of the ViewHelper as used as key in the the JSON include file. |
9 changes: 9 additions & 0 deletions
9
Documentation/WritingReST/Reference/Content/_ViewHelper/_NoIndex.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. confval:: :noindex: | ||
:name: directive-viewhelper-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. |
22 changes: 22 additions & 0 deletions
22
Documentation/WritingReST/Reference/Content/_ViewHelper/_SortBy.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.. confval:: :sortBy: | ||
:name: directive-viewhelper-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. | ||
|
||
.. code-block:: rst | ||
.. typo3:viewhelper:: split | ||
:source: resources/global_viewhelpers_demo.json | ||
:sortBy: name | ||
.. typo3:viewhelper:: image | ||
:source: resources/global_viewhelpers_demo.json | ||
:sortBy: json |
16 changes: 16 additions & 0 deletions
16
Documentation/WritingReST/Reference/Content/_ViewHelper/_Source.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.. confval:: :source: | ||
:name: directive-viewhelper-source | ||
:type: string, local file path, relative or absolute | ||
|
||
Path to the source JSON file to be included. Can be relative or absolute. | ||
|
||
.. code-block:: rst | ||
.. viewhelper:: my.viewhelper | ||
:source: /some/absolute/path/_includes/_my_viewhelper.json | ||
.. viewhelper:: my.viewhelper | ||
:source: ../_includes/_my_viewhelper.json | ||
The path is calculated starting from the :path:`Documentation` directory. | ||
It is not possible to include files from different locations in an extension. |
31 changes: 31 additions & 0 deletions
31
Documentation/WritingReST/Reference/Content/_ViewHelper/_global_viewhelpers_demo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
{ | ||
"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 | ||
}, | ||
"...": "..." | ||
} | ||
} |