Feature #1907
Default values for view helpers based on context
Added by Sebastian Kurfuerst over 13 years ago.
Updated about 8 years ago.
Description
We should supply a mechanism in the "ViewHelperNode" which will merge the given parameters with certain default parameters.
The default parameters should be context dependent (However, we don't know yet how this might look like).
This would be helpful for numerous cases:
- <f3:uri.linkTo> -> "action", "controller", and "package" arguments could be supplied if no other parameter given
- Link parameters - we could realize something like "keepPIVars" with this feature
- <f3:image> tag - supplying default parameters for maxWidth, maxHeight, ...
while writing some view helpers i realized again: we need a "private" context that is available in the view helpers.
instead of an array this could be a class with getters for current view, global settings, default arguments...
default arguments could be an array like:
array(
array('\F3\Fluid\ViewHelpers\Format\DateViewHelper' => array(
'format' => 'Y-m-d'
),
array('\F3\Fluid\ViewHelpers\LinkViewHelper' => array(
'package' => 'foo',
'controller' => 'bar',
...
In prepareArguments() of the abstract view helpers, the default arguments could be taken into account.
I don't really know anymore the intention of this... We need to discuss this as soon as I am back (e.g. next tuesday) - Greets Sebastian :-)
I don't really know anymore the intention of this
I still remember - it's a very neat feature. And it will be especially useful for TYPO3:
Then you can eg. specify via TypoScript that currencyViewHelper has a default format of '##,## €' in the german branch and '##.## $' in the American..
In conjunction with this I thought of following:
{object} could internally call some kind of "defaultViewHelper" which has an argument "escapeHtml".. So you could enable htmlspecialchars for html templates and disable it for special setups.
Well, just a very rough idea..
- Category set to 444
- Target version set to 1.0.0 alpha 1
- Target version changed from 1.0.0 alpha 1 to 1.0
- Branch set to v4 + v5
- Target version deleted (
1.0)
- Status changed from New to Needs Feedback
- Priority changed from Should have to Could have
What kind of feedback do you want? ;)
Bastian Waidelich wrote:
I don't really know anymore the intention of this
I still remember - it's a very neat feature. And it will be especially useful for TYPO3:
Then you can eg. specify via TypoScript that currencyViewHelper has a default format of '##,## €' in the german branch and '##.## $' in the American..
In conjunction with this I thought of following:
{object} could internally call some kind of "defaultViewHelper" which has an argument "escapeHtml".. So you could enable htmlspecialchars for html templates and disable it for special setups.
Well, just a very rough idea..
I like that idea - especially the escape part, as I'm currently trying to render a plaintext mail content with Fluid and everything is rendered through HSC :(. But default viewHelper arguments like format options should get injected differently then the escaping stuff. Escaping should depend on the renderingContext, whereas the other options could be defined via TS (in v4 maybe via tx_fluid.viewHelper.[packageKey].format.date.defaultArguments.format = d.m.Y).
This feature might especially be needed for widgets, which of course should be globally configurable, otherwise they don't make much sense IMO.
- Tracker changed from Feature to Major Feature
- Category set to Core
- Status changed from Needs Feedback to New
- Tracker changed from Major Feature to Story
- Tracker changed from Story to Feature
Also available in: Atom
PDF