Skip to content

Use fluid components#6432

Open
Alagts wants to merge 11 commits intoTYPO3-Documentation:mainfrom
Alagts:use-fluid
Open

Use fluid components#6432
Alagts wants to merge 11 commits intoTYPO3-Documentation:mainfrom
Alagts:use-fluid

Conversation

@Alagts
Copy link
Copy Markdown
Contributor

@Alagts Alagts commented Mar 24, 2026

This commits should provide an introduction to usage of the Fluid components. In the next patch I will include the PSR-14 events and the file Namespaces.php.

I had to remove the PSR events, because otherwise the patch would be too big. I decided to separate them into smaller parts. I added the new changes from the main branch that come into it during the time of preparing the pr.

.. code-block:: php
:caption: EXT:my_extension/Configuration/Fluid/ComponentCollections.php

<?php
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this into a separate file? This way, the file is automatically formatted.


All arguments that are passed to a component need to be defined with
:html:`<f:argument>` in the component template, for example
:file:`Navigation.fluid.html`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mention "Navigation.fluid.html", but is there an example available where someone can see the <f:argument>s?


<?php

return [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a full example so it is clear where to put this snippet.

that it defines all of its arguments with the
`Argument ViewHelper <f:argument> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-argument>`_.
The `Slot ViewHelper <f:slot> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-slot>`_
can be used to receive other HTML content. With the Slot ViewHelper it is possible to nest components.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link "Slot ViewHelper" to the Fluid VH docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just before this line it is linked. :)

Migration and co-existence with class-based collections
-------------------------------------------------------

Since TYPO3 v14 you should use the configuration-based component collections over
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to first create a PR for v13 and main. When this is merged/backported (and all work done for v13), then the v14 part should be worked on which is then merged only to main.

Otherwise you end up with documentation for v14 in v13 docs - which is not really ideal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that Fluid Components shouldn't really be documented for TYPO3 v13. The fact that they could be used in v13 was kind of a hack, now official support is added with v14, which is when this should be documented in the TYPO3 documentation.

Nevertheless, if you come from v13, there should be a place that shows how to migrate the old implementation to the new one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fine for me. As a "Releases" line is lacking, it was not obvious for which branches the PR is meant.

Alagts and others added 4 commits March 24, 2026 09:28
Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@sarahmccarthy123 sarahmccarthy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good:-) Just a a few language suggestions

Description
-----------

With version 4.3 the concept of components was introduced into Fluid.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this needs a ".. versionadded:: 14.3" instead of a description?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is about Fluid, I think it is sufficient to just mention it in the text.

Registering component collections
---------------------------------

In order to use Fluid components register a component collection
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to use Fluid components register a component collection
In order to use Fluid components, register a component collection

],
];

in which you define the path your Fluid components can be found.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in which you define the path your Fluid components can be found.
in which you define the path where your Fluid components can be found.

];

in which you define the path your Fluid components can be found.
Components in that collections can then be used in any Fluid template.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Components in that collections can then be used in any Fluid template.
Components in these collections can then be used in any Fluid template.


<my:organism.header.navigation />

Note that by default, component collections use a folder structure that
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that by default, component collections use a folder structure that
Note that, by default, component collections use a folder structure that

The `Slot ViewHelper <f:slot> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-slot>`_
can be used to receive other HTML content. With the Slot ViewHelper it is possible to nest components.

Example: How you could define a Fluid component
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Example: How you could define a Fluid component
Here is an example of how you could define a Fluid component:


You can learn more about components in
`Defining Components <https://docs.typo3.org/permalink/fluid:components-definition>`_. Note
that this is part of the documentation of Fluid Standalone, which means that it doesn't mention
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
that this is part of the documentation of Fluid Standalone, which means that it doesn't mention
that this is part of the Fluid Standalone documentation, which means that it doesn't mention

In TYPO3 v13 it is possible to use components in TYPO3 projects by creating a custom
:php:`ComponentCollection` class that essentially connects a folder of template files
to a Fluid ViewHelper namespace. Using that class it is also possible to use an
alternative folder structure for a component collection and to allow passing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alternative folder structure for a component collection and to allow passing
alternative folder structure for a component collection and to allow

:php:`ComponentCollection` class that essentially connects a folder of template files
to a Fluid ViewHelper namespace. Using that class it is also possible to use an
alternative folder structure for a component collection and to allow passing
arbitrary arguments to components within that collection.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arbitrary arguments to components within that collection.
arbitrary arguments to be passed to components in that collection.

a component collection. Since the configuration-based approach is not available in TYPO3 v13,
it is possible to ship both variants to provide backwards-compatibility:
if a specific component collection is
defined both via class and via configuration, in TYPO3 v13 the class will be used,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defined both via class and via configuration, in TYPO3 v13 the class will be used,
defined both by class and by configuration, in TYPO3 v13 the class will be used,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants