简体   繁体   English

在Symfony表单中包含自定义HTML的最佳方法是什么?

[英]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.

相关问题 通过 ajax echo 命令包含 html 的最佳方法是什么? - What's the best way to include html through an ajax echo command? 使用composer和assets为symfony项目包含jQuery的最佳方法是什么 - What is the best way to include jQuery for symfony project using composer and assets 如何制作(最佳方式)特定的自定义Symfony 2表单元素类型? - How to make (best way) specific custom Symfony 2 form element type? 通过电子邮件发送表单详细信息的最佳方法是什么? - What's the best way to email form details? 在 Symfony 中添加双输入字段表单类型的最佳方法是什么? - What is the best way to add double input field form type in Symfony? 将 php 数据库数据包含在 HTML 中的最佳方法是什么 - What is the best way to include php database data with HTML 在Symfony2上包含多个资产的最佳方法 - Best way to include multiple assets on Symfony2 将自定义搜索表单添加到wordpress导航菜单的最佳方法是什么? - What is the best way to add a custom search form to the wordpress navigation menu? 在Mysql上存储大量表单信息的最佳方法是什么? - What's the best way to store a lot of form information on a Mysql? 在后端的Wordpress中处理表单数据的最佳方法是什么? - What's the best way to handle form data in wordpress in the backend?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM