Feature #75289
closedInterfaceNode in Fluid
0%
Description
Dear Fluid Team,
When I was working on my company's project with TYPO3 v7.6.4, I noticed it would be sweet if I can use {\Vendor\Extension\Interface\SomeInterface::SOME_PARAMETER} in the Fluid template directly rather than $this->assign().
Attached is how I did, maybe it can be included in the core file. And, feel free to update the code if needed, more security is perferred :)
Thank you for the great extension.
Cheers,
Bill
Files
Updated by Claus Due over 8 years ago
- Status changed from New to Rejected
Hi Bill,
Thanks for the example code! Something very similar to this is now possible in TYPO3v8 and onward through public API due to it being possible in the standalone Fluid engine that's now the base. To achieve the same in Fluid presently, the ExpressionNode feature allows creating this (and many other such inline-style extended expressions). Another option exists via custom VariableProviders (previously TemplateVariableContainer, given a more prominent role) which can be created to return variables which were never assigned - but would not support the syntax you implemented (would have to use dotted paths instead of backslashes and colons, e.g. {Vendor.Extension.Interface.SomeInterface.SOME_PARAMETER} or it would not be detected as a variable reference (there is no way to change the expression responsible for detecting variable references, among other things for security reasons).
Although we appreciate the contribution, I reject this issue for the following reasons:
- It cannot be applied to the 7.6 branch since it is LTS and receives no new features. Unfortunately, as you found out, Fluid on 7.6 cannot be configured to support this without significant changes to parsing etc.
- It can be applied to TYPO3v8 and onward via the means described above, but is not (and this is my assumption of team conclusions, I could be wrong!) required frequently enough to be implemented in either standalone Fluid or CMS Fluid.
- It can be delivered on TYPO3v8 and onward as an extension or a simple composer package (which would also allow it to work on any other platform using standalone Fluid!) and implemented in templates when needed, for example using a ViewHelper that modifies the RenderingContext during tag content rendering to add ExpressionNodes or custom VariableProviders, or just providing classes that can be added to the RenderingContext when desired.
If you are interested in learning more about either solution there are examples for both in the standalone Fluid package. And if you feel the decision to close/reject this issue is incorrect don't hesitate to let us know ;)
Updated by Bill Dagou over 8 years ago
Hi Claus,
It's good to hear v8 could archieve this.
Actually, this is my second time using Extbase and Fluid, and I'm quite new with it. So never mind, as long as TYPO3 grows better and better.
Thanks for the work of all of you!
Cheers,
Bill