[英]What's the best way to include custom HTML in a Symfony form?
I'm working with a Symfony generated admin and need to include some custom HTML into a form. 我正在使用Symfony生成的管理员,并且需要在表单中包含一些自定义HTML。 This HTML (a label, img tag, and link) should only appear when the action is 'edit'.
该HTML(标签,img标签和链接)仅在操作为“编辑”时出现。 What's the best way to do this?
最好的方法是什么? It seems like I should just be able to include a partial, but I don't know where to include it from.
似乎我应该只可以包含部分内容,但是我不知道从哪里包含它。 Thanks.
谢谢。
Depending on the functionality you want the partial to have you could also write a custom widget and use your custom widget instead of the standard symfony one. 根据您希望部分对象具有的功能,您还可以编写一个自定义窗口小部件并使用自定义窗口小部件,而不是标准的symfony。 (I use this for a widget wich displays me various sizes of images after a file upload)
(我将其用于小部件,以便在文件上传后向我显示各种尺寸的图像)
我想我找到了解决方案:我创建了一个局部并将其设置为显示在moduel的generator.yml文件中(在“编辑”部分中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.