Share buttons don't show up in TYPO3 11 project because of double quotes in data-services attribute

Issue #32 closed
Stefan Fellner created an issue

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)

  1. Markus Klein

    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)

  2. Stefan Fellner 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!

  3. Log in to comment