b1gw0rm - 8 months ago

Is it possible to use {% %} or {{ }} tags in the WYSIWYG? Currently we have WYSIWYG field stacked on an HTML field in our page template in order to allow us to add custom Twig tags via the page editor since the HTML field allows for it. Previous Pyro you could add template stuff {{ }} inline inside the WYSIWYG. It would be nice to be able to use TWIG to inline stuff inside the WYSIWYG and not have to add a separate HTML field for each page to handle that. However, I understand there are likely design/development reasons for not letting TWIG tags be parsed by the WYSIWYG field type.

Answer

edster - 8 months ago

Yep you can, but you have to enter it in HTML mode. If you don't it will parse the tags into character codes. Make sure you are rendering the WYSIWYG with |raw though.

edster - 8 months ago

Yep you can, but you have to enter it in HTML mode. If you don't it will parse the tags into character codes. Make sure you are rendering the WYSIWYG with |raw though.

ryanthompson - 8 months ago

You can also pass variables like a view include too: https://pyrocms.com/documentation/wysiwyg-field-type/latest#usage/presenter-output/wysiwygfieldtypepresenter-render