Symfony2 独立表单组件 - 设置表单

2022-01-21 00:00:00 forms php symfony components

我正在尝试将 Symfony2 表单构建器组件实现为独立的.文档不过并没有真正谈论这个,只是与使用整个框架有关.

I'm trying to implement Symfony2 form builder component as a standalone. The documentation doesn't really talk about this though, just in relation to using the whole framework.

独立版在 Github 上,但没有文档.

The standalone is on Github but has no docs.

我四处搜索,看到有几个人问这个问题,但似乎没有人有任何答案.

Ive searched around and seen a few people ask this question but none seems to have any answers.

我所需要的只是关于如何设置、构建和查看表单的基本指南.

All I need is a basic guide on how to setup a form , build it, then view it.

有人吗?

推荐答案

编辑:我下面的第一个响应现在已经过时(并且链接不再起作用).请参阅https://github.com/webmozart/standalone-forms 了解最新状态艺术解决方案.

Edit: My first response below is now obsolete (and the link does not work anymore). Please refer to https://github.com/webmozart/standalone-forms for a state-of-the-art solution.

以前的(现已过时的)答案:

我已经努力并设法显示了一个表单(使用 PHP 引擎,而不是 Twig).

I've tried hard and managed to display a form (using PHP engine, not Twig).

确实需要一些组件:Form,还需要 ClassLoader、EventDispatcher、Templating(用于渲染) 和翻译(用于渲染标签).您还需要 FrameworkBundle 包中的一些资源(主要是模板).

Indeed you need a few components: Form, but also ClassLoader, EventDispatcher, Templating (for rendering) and Translation (for rendering labels). You will also need some resources from the FrameworkBundle bundle (mainly templates).

更多信息:http://forum.symfony-project.org/viewtopic.php?f=23&t=36412

还有我的迷你教程:http://n.clavaud.free.fr/blog/index.php?article31/symfony2-standalone-form-component-tutorial

相关文章