Ad

TYPO3 Mask Elements - Wrong Output

- 1 answer

I am using TYPO3's mask element extension to create a mask element. There I'm using a RTE to enter some text and print it to the screen. The HTML for the mask element looks like this:

<f:if condition="{data.tx_mask_text}">{data.tx_mask_text}<br /></f:if>

The problem now is that I can add some text here and it also is printed. But the text also includes HTML tags. So if I type in "Hello" as text into the RTE, then the output is <p>Hello</p>.

Any idea how to fix this?

Ad

Answer

I had a similar issue. All you need to do is add some ViewHelper to your variable, which should be printed, in your case:

<f:if condition="{data.tx_mask_text}">{data.tx_mask_text -> f:format.html(parseFuncTSPath: 'lib.parseFunc')}<br /></f:if>

The ViewHelper removes all the tags from the text. See further information here:

https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Format/Html.html

Ad
source: stackoverflow.com
Ad