- changed status to new
Share buttons don't show up in TYPO3 11 project because of double quotes in data-services attribute
I stumbled upon a problem with this extension in a TYPO3 11 project of mine (11.5.33), where the share buttons would not show up on a news detail page because the browser rendered the data-services attribute like this:
data-services="[" facebook","xing","twitter"]"=""
Changing the double quotes of the attribute to single quotes on line 60 of the ShariffViewhelper fixed it for me:
'[\'' . implode('\',\'', $services) . '\']'
Not sure if this is a general problem or somehow specific to this TYPO3 version, but might be worth looking into.
Comments (6)
-
-
Thanks. Good finding. Will fix this.
-
It used to work in TYPO3 v10 as the generated Fluid was
data-services="["facebook","twitter","whatsapp"]"
I’m wondering why your output hasn’t been escaped properly?(Good to know that it works with single quotes though)
-
- changed status to resolved
[BUGFIX] Use single quotes in HTML in viewhelper
This should help in cases, where the output is not escaped correctly.
Fixes:
#32→ <<cset 04769b7dd19b>>
-
reporter I’m not sure why the escaping didn’t work properly in my case, at least in my case the browser interpreted the first
"
as a"
, which immediately closed the first double quote and messed up the attribute value. TYPO3s TagBuilder render function also inserts double quotes around the attribute value during string concatenation, which might have caused the problem in some way. Thank you for the quick fix!
-
- changed status to closed
- Log in to comment