Symfony 1.4 后端:generator.yml 和自定义部分的表单类共存
我正在构建一个后端管理员,用于在在线报纸上撰写文章,我需要插入图像(一对多关系)。实际上,我编写了一个处理要显示的字段的表单,并且效果很好。
现在我想添加一个部分,它将显示已链接到文章的图像,因此我有一个带有操作executeShowImages 的组件类以及模板_showImages.php。
我的问题 我想将所有定义保留在表单类中,但仅添加此组件/部分显示,我无法轻松做到这一点。这是我的生成器文件:
generator:
class: sfPropelGenerator
param:
model_class: article
theme: admin
non_verbose_templates: true
with_show: false
singular: article
plural: articles
route_prefix: article
with_propel_route: 1
actions_base_class: sfActions
config:
actions: ~
fields: ~
list: ~
filter: ~
form:
class: ArticleFormBackend
display: [ ~showImages ]
edit: ~
new: ~
如果我这样做,则仅显示 showImage 组件。怎样才能做到这一点呢?
非常感谢您的帮助
I am building a backend admin for writing articles on an online newspaper and I need to insert images (1-to-n Relation). Actually I wrote a form which handles the fields to display and this works well.
Now I want to add a partial which will display the images already linked to the articles, so I have a component class with an action executeShowImages as well as a template _showImages.php.
My question
I would to keep all the definition in the form class, but just add this component/partial display and I cannot do it easily. Here is my generator file:
generator:
class: sfPropelGenerator
param:
model_class: article
theme: admin
non_verbose_templates: true
with_show: false
singular: article
plural: articles
route_prefix: article
with_propel_route: 1
actions_base_class: sfActions
config:
actions: ~
fields: ~
list: ~
filter: ~
form:
class: ArticleFormBackend
display: [ ~showImages ]
edit: ~
new: ~
If I do it this way, only the showImage component is displayed. How can do that?
Thanks a lot for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你是对的 - “仅显示 showImage 组件”。
您应该插入您想要查看的所有字段的列表(如果您覆盖选项)。
所以你的表单选项应该是这样的:
Yes you are right - 'only showImage component is displayed'.
You should to insert list of all fields you want to see (if you override option).
So your form option should be something like this: