Feature #89981
closedTrim identifier spaces in core IconViewHelper
0%
Description
<core:icon identifier="actions-version-document-remove " size="small" />
Updated by Oliver Hader over 4 years ago
- Subject changed from Trim spaces in core IconViewHelper to Trim identifier spaces in core IconViewHelper
Updated by Guido Schmechel over 4 years ago
Maybe I also misunderstand the request. But don't we have to include trim() in all ViewHelper for all arguments? What makes this field so special? Comparable to me is the ImageViewHelepr with src.
Updated by Georg Ringer over 4 years ago
- Status changed from New to Needs Feedback
Updated by Oliver Hader over 4 years ago
I agree that this should be tackled in other view helpers as well - probably not in "all", but in a lot...
Updated by Georg Ringer over 4 years ago
- Tracker changed from Bug to Feature
- Target version set to Candidate for Major Version
I guess there should be a new property trimArguments
which could be default on and if someone needs those spaces, it needs to be disabled. This way we don't need to tackle every VH. what do you think?
switching this to feature
Updated by Claus Due over 4 years ago
Note that this argument is not a tag attribute that is output and only has impact internally in affected ViewHelpers.
It would not be feasible to implement a "trimArguments" property to solve this use case:
- Implementing it per-argument would require an API change in Fluid which would be breaking meaning it would only happen for Fluid 3.0 and above.
- Implementing a general "trimArguments" property would require a base class in TYPO3 CMS which no longer exists.
- Generally speaking it would not be safe to universally trim string arguments.
- Fluid behaves explicitly concerning strings: what you pass is what you receive.
The more appropriate solution is to internally use trim() on the argument only in cases where this may be likely to happen. Or document that it is improper practice to add whitespace in such argument values since the value is received verbatim.
On a side note, this use case is probably unlikely to occur in the wild, since the argument only supports a single value - unlike for example "class" which is far more likely to contain a value like "{class1} {class2}" where we would indeed like to trim away any whitespaces if either of the variables are empty. However, trimming the value in this use case has no impact on browser interpretation of the attribute and is therefore redundant.
My personal recommendation would be the close the issue and avoid the described syntax for ViewHelpers that use the argument value as input for other methods - and preserve the verbatim passing of argument value in template as real value for the argument in PHP.
Updated by Benni Mack about 2 months ago
- Status changed from Needs Feedback to Rejected
Dear Mr. Hader,
this will probably not make it in TYPO3. Due to this edge-case, the mentioned feedback and the lack of people-power to implement this change.