Skip to main navigation Skip to main content Skip to page footer
Fluid gets template APIs: The new f:argument ViewHelper

Fluid gets template APIs: The new f:argument ViewHelper

Have the article read aloud.

Loading the Elevenlabs Text to Speech AudioNative Player...
| Estimated reading time : min.
This article was automatically translated using DeepL. Therefore, inaccuracies may occur.

Fluid 4.2.0 brings an exciting feature: the <f:argument> ViewHelper takes templates and partials to a new level. We can finally give our templates clear APIs.

Until now, it was sometimes a guessing game: Which variables does this partial need? What type does it expect? What happens if I forget something? The new ViewHelper solves these problems elegantly.

What does f:argument do?

You define directly in the template which variables are required, which types they have and which are optional. Fluid then automatically checks the output: Are the transferred values correct? Is something important missing? If so, there is a clear error message.

This makes templates self-documenting. A glance at the first few lines immediately reveals the complete API - i.e. which "inputs" the template has and what it expects. Perfect for teams or when you look at your own templates again after months.

My first thoughts

I find this very interesting and will certainly test it in practice soon. I see enormous potential, especially for more complex partials that are used in different contexts. Finally an end to "Why doesn't the partial work here?" - discussions.

The official documentation shows all the details, and you can find the technical background in the commit message.

What do you think about it?

Will you use the new ViewHelper?

Do you see any other use cases or potential problems?

Share your thoughts in the comments - I look forward to hearing your experiences and opinions on this exciting update!

Back

Do you have a question or want to discuss the topic?

In the Community Hub for TYPO3 you can exchange ideas with other TYPO3 users. And if you don't want to miss any new articles: The TYPO3 Newsletter comes once a month, without spam.

Wolfgang Wagner

Wolfgang Wagner

TYPO3 Trainer, Integrator und Berater TYPO3 Certified Integrator (TCCI)

Wolfgang Wagner – TYPO3 Seminare und Support · TYPO3 Education and Certification Committee · TCCI Task Force

Wolfgang Wagner arbeitet seit 2006 mit TYPO3 und ist unter wwagner.net als Trainer, Integrator und Berater aktiv. Schwerpunkt sind Schulungen, Online-Kurse und individuelle Beratung für Integratoren, Agenturen und Betreiber von TYPO3-Webseiten, die TYPO3 sauber, modern und wirtschaftlich einsetzen wollen. Er ist Mitglied im TYPO3 Education and Certification Committee und in der TCCI Task Force und gestaltet die offizielle TYPO3 Certified Integrator Prüfung aktiv mit.