Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v:tag adds additionalAttributes even if their value is empty #1125

Open
cweiske opened this issue Sep 29, 2016 · 6 comments
Open

v:tag adds additionalAttributes even if their value is empty #1125

cweiske opened this issue Sep 29, 2016 · 6 comments

Comments

@cweiske
Copy link
Contributor

cweiske commented Sep 29, 2016

The description of <v:tag> says:

Creates one HTML tag of any type, with various properties like class and ID applied only if arguments are not empty, rather than apply them always - empty or not - if provided.

Unfortunately, all attributes brought in via additionalAttributes are added always, regardless of their value.

This makes it hard to create a <video> tag without a poster attribute when the respective variable is empty.

@NamelessCoder
Copy link
Member

I think this makes sense as a general feature for Fluid itself, as part of AbstractTagBasedViewHelper. We could achieve this with an additional argument for any TagBasedViewHelper, for example ignoreEmptyAttributes or skipEmptyAttributes with a default of FALSE (at least until we are ready for a breaking change). Right now VHS needs a list of attribute names that must be ignored if empty (default is ['id', 'class']) and the Trait is designed to let you pass this array from implementing classes. You are most welcome to submit a PR to, for example, allow defining these attribute names as an argument for v:tag - but I am not sure we should be changing the behavior of additionalAttributes here, compared to any other TagBasedViewHelper (like the Form ones). That's where we need a general feature.

The conclusion looks like:

  • We can make it possible to do this for root arguments excluding additionalAttributes in VHS's TagViewHelperTrait (it would also be possible to target the universal tag attributes).
  • We cannot make this a generally supported thing on 7.6, but we can add it to standalone Fluid to get access in TYPO3 8.4 and above.
  • The only reason for not wanting to touch additionalAttributes in TagViewHelperTrait is it would add to the confusion if VHS TagBasedViewHelpers handled it one way and and core ones did it another way. That said, if the behavior is opt-in, I would consider a pull request to add that.

Would you mind opening a feature request for https://github.com/TYPO3Fluid/Fluid so we at least get it added there at some point?

@cweiske
Copy link
Contributor Author

cweiske commented Mar 15, 2017

issue opened.

@NamelessCoder
Copy link
Member

Available as Fluid core feature since Fluid 2.4.0 - TYPO3/Fluid#302.

@cweiske
Copy link
Contributor Author

cweiske commented Mar 4, 2024

It seems as if the base feature (ignoreEmptyAttributes) is available in fluid core, but no attribute in v:tag exposes this option.
Please reopen.

@cweiske
Copy link
Contributor Author

cweiske commented Oct 28, 2024

The problem still applies with vhs 6.1.2.

@NamelessCoder NamelessCoder reopened this Oct 28, 2024
@NamelessCoder
Copy link
Member

Issue reopened but there will be no more releases for the 6.x branch - the fix will be 7.x only!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants