开发者

Symfony 1.4 admin generator - use raw HTML in 'list' view?

开发者 https://www.devze.com 2023-02-12 08:52 出处:网络
I am using Tin开发者_如何学CyMCE for rich text editing of a column which I want to show on the Symfony\'s admin generator \'List\' view.

I am using Tin开发者_如何学CyMCE for rich text editing of a column which I want to show on the Symfony's admin generator 'List' view.

However when I include this column, the escaped HTML is shown, rather than rendered.

Is there any way to tell the admin generator to use getRaw() for this one column, instead of turning off output escaping for the entire backend app?


It is not possible to do in the current admin generator - you need to duplicate the partial and make a manual change.


You should try using this sentence when outputing something that should be rendered:

<?php echo sfOutputEscaper::unescape($whatever_you_like_to_be_rendered) ?>

This way you use the unsecape in a case by case basis.


I solved this problem when I created my own admin theme. I added an html_whitelist setting to the generator.yml that takes an array of field names and exempts them from any output escaping. I believe I also had modified the partial that outputs these fields (_list_td_tabular perhaps) so 'listen' to the whitelist. I wouldn't recommend this solution if you're using the default Symfony admin generator (b/c you'd have to modify internal code), but if you're using a custom admin theme, go for it! ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消