Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Add inline syntax to Fluid syntax #1948

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Documentation/ApiOverview/Fluid/Syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,50 @@ curly braces:
:caption: EXT:site_package/Resources/Private/Templates/SomeTemplate.html

Now it is: <f:format.date format="{format}">{date}</f:format.date>

Fluid inline notation
=====================

.. tip::

There is an online converter from tag-based syntax to inline syntax:
`Fluid Converter <https://fluid-to-inline-converter.com/>`__

An alternative to the tag based notation used above is inline notation. For
example, compare the 2 identical Fluid constructs:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive"/>

<!-- inline notation -->
{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive')}

Tag based notation and inline notation can be freely mixed within one Fluid
template.

Inline notation is often a better choice if HTML tags are nested, for example:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<span title="<f:translate key='LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive'/>">

<-- inline notation -->
<span title="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:bookmark_inactive')}">

More complex example with chaining:

.. code-block:: html
:caption: EXT:my_extensions/Resources/Private/Templates/Something.html

<!-- tag based notation -->
<f:format.padding padLength="40"><f:format.date format="Y-m-d">{post.date}</f:format.date></f:format.padding>

<!-- inline notation -->
{post.date -> f:format.date(format: 'Y-m-d') -> f:format.padding(padLength: 40)}