Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable automated encoding of special characters in fluid partials (TYPO3)

Tags:

typo3

fluid

Should be simple enough. I'm trying to add an input field to a fluid partial in the extension "yag" (yet another gallery).

Input: <f:form.textfield id="live-filter" name="test" />

Output: &lt;input id=&quot;live-filter&quot; type=&quot;text&quot; name=&quot;test&quot; /&gt;

Somehow the code get's filtered along the way, but I don't know why. TYPO3 v. 6.2

YAG v. 3.2.1

Edit: A wild guess would be some output filtering in TYPO3 itself, but where? I didn't set anything by purpose.

like image 492
Florian Rachor Avatar asked Mar 20 '23 13:03

Florian Rachor


2 Answers

You need to traverse the path upwards to check if there is any fluid tag wrapped around it, that does escaping. In general, all tags do escaping. Also check the code around <f:render partial....

It could also be that the TypoScript code that does calls the fluid template, has a .htmlspecialchars = 1 set.

like image 198
pgampe Avatar answered Apr 27 '23 14:04

pgampe


Since TYPO3 8 there is another pitfall: Custom Viewhelpers do htmlspecialchars on the output unless told otherwise. The solution is:

<?php
namespace Vendor\ArTest\ViewHelpers;

class YourViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper{

  /**
    * As this ViewHelper renders HTML, the output must not be escaped.
    *
    * @var bool
    */
  protected $escapeOutput = false;
like image 40
Markus Avatar answered Apr 27 '23 16:04

Markus