This documentation is not using the current rendering mechanism and will be deleted by December 31st, 2020. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Fluid Views with extended capability¶
The main feature provided by this extension is now available in the TYPO3 core. Use core's support for paths instead.
Extends the standard Views in Fluid with classes that have additional capabilities.
ViewHelper Argument Values¶
If a ViewHelper instance's arguments' value has not been defined in the Fluid template it is possible to set it through TypoScript. All you have to know is the class name of the ViewHelper that contains the argument:
Beware: the defined default values only apply when the value is not specified. This means that if the value is specified in the Fluid template it is not overridden, regardless of being empty or not. Overrides always override, argument present or not.
Template Path Overlays¶
No more copying of entire folders of templates just to override one single template file. Instead, let EXT:view take care of that by overriding the default TemplateView and adding a simple capability.
plugin.tx_news.view.overlays.myext.partialRootPath = EXT:myext/Resources/Private/Partials/
With just one file in the
EXT:myext/Resources/Private/Partials/ path - fx
the overridden View now analyzes each overlay path to detect an overlay file for the specific file that is being referenced.
Each of the Partial, Template and Layout root paths can be overlayed individually and overlays can be mixed up. Let's assume
that you want
EXT:foo to provide a couple of Partials and a Layout for
EXT:news but want
EXT:bar to provide a single Partial
template file because that's how you like it. Let's assume
EXT:foo contains these files:
EXT:bar contains this file:
EXT:view it would be impossible to gain access to both these Partials from the same page. But with
EXT:view it is
plugin.tx_news.view.overlays.foo.partialRootPath = EXT:foo/Resources/Private/Partials/ plugin.tx_news.view.overlays.foo.layoutRootPath = EXT:foo/Resources/Private/Layouts/ plugin.tx_news.view.overlays.bar.partialRootPath = EXT:bar/Resources/Private/Partials/
Giving the following behavior in
EXT:view when the Partial template
Category/Items.html is requested:
- Tries to find the template in
EXT:barbecause it has added a Partial template path overlay and did so last. The last TypoScript to be added takes priority, just as it normally would. But the template file is not found here so we continue.
- Tries to find the template in
EXT:foobecause it is next. This path has the template file so this file is returned by
The exact same logic applies to every set of template paths. If requesting a Layout file then only the overlays which have the
layoutRootPath setting are considered. If a file is not found, the next overlay is analyzed until finally
to the old behavior.
There is almost zero performance impact from
EXT:view. The same TypoScript location is used and therefore is alreay available
when rendering, so the only impact from
- Extremely minimal overhead in TypoScript
- Near-zero overhead when loading classes
- Slight (short string-processing and array sorting) overhead per registered overlay that has to be processed
In total the impact is a few megabytes of memory, some additional TS parsing initially and a handful of function calls per overlay.
Implementing the extended View¶
- Install the extension
- Go to extension manager and click the gears right to EXT:view to go to extension configuration
- Here you can enable view path overlay and ViewHelper overlay separately by checking the respective checkbox
- Save the configuration
- Youre done - overlays are enabled!
Supported TYPO3 versions¶
Why is this not part of the TYPO3 core extension Fluid or even Flow? I want this in Neos too, you know!¶
If the core wants it, the core can certainly have it. But I don't want to waste my time arguing first why this should be part of Flow, then make it for Flow, then backport it and then finally be able to submit what I already made. I spent only three hours making this and I'll be damned if I should then spend three months battling the TYPO3 contribution hurdle system. With the way things are I would probably battle all the way until Neos is released. So there you have it.