Project

General

Profile

Actions

Feature #89981

open

Trim identifier spaces in core IconViewHelper

Added by Oliver Hader over 4 years ago. Updated about 4 years ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
Fluid
Start date:
2019-12-17
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

<core:icon identifier="actions-version-document-remove           " size="small" />
Actions #1

Updated by Oliver Hader over 4 years ago

  • Assignee set to Oliver Hader
Actions #2

Updated by Oliver Hader over 4 years ago

  • Subject changed from Trim spaces in core IconViewHelper to Trim identifier spaces in core IconViewHelper
Actions #3

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.

Actions #4

Updated by Georg Ringer over 4 years ago

  • Status changed from New to Needs Feedback
Actions #5

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...

Actions #6

Updated by Georg Ringer about 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

Actions #7

Updated by Claus Due about 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.

Actions

Also available in: Atom PDF