使用 Symfony 在生成的管理中自定义渲染
所以,这是我的小问题:我已经使用 Symfony 管理生成器生成了一个管理,但我需要显示一个可以单击以打开 CV 文件的链接(或与此相关的按钮)。
截至目前,我有:
generator:
class: sfDoctrineGenerator
param:
model_class: Client
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: client
with_doctrine_route: true
actions_base_class: sfActions
config:
actions: ~
fields:
job_titles_list: { label: Emplois disponnibles }
created_at: { label: Cree le }
updated_at: { label: Mis a jour le }
list:
display: [=name, firstname, experience, connexe, formation, created_at, cv_file]
title: Gestion des prospects
filter:
display: [name, firstname, phone, cellphone, postalcode, experience, connexe, formation, job_titles_list, created_at, updated_at]
form: ~
edit:
fields:
formation: { label: Formation }
experience: { label: Experience }
connexe: { label: Connexe }
new: ~
如您所见,在列表/显示中,我有一个 cv_file,它给了我一个链接(来自数据库)。我需要用链接呈现此列。
顺便说一下,我对 Symfony 一无所知,所以要温柔一点;)
非常感谢!
So, here's my little problem: I have generated an admin with the Symfony admin generator, but I need to display a link (or a button for that matter) that can be click to open a C.V. file.
As of now, i have:
generator:
class: sfDoctrineGenerator
param:
model_class: Client
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: client
with_doctrine_route: true
actions_base_class: sfActions
config:
actions: ~
fields:
job_titles_list: { label: Emplois disponnibles }
created_at: { label: Cree le }
updated_at: { label: Mis a jour le }
list:
display: [=name, firstname, experience, connexe, formation, created_at, cv_file]
title: Gestion des prospects
filter:
display: [name, firstname, phone, cellphone, postalcode, experience, connexe, formation, job_titles_list, created_at, updated_at]
form: ~
edit:
fields:
formation: { label: Formation }
experience: { label: Experience }
connexe: { label: Connexe }
new: ~
As you can see, in list/display, i have a cv_file, which gives me a link (from the DB). I need to render this column with a link.
By the way, I know nothing about Symfony, so be gentle ;)
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在列表中使用虚拟字段,例如_curriculum:
这样Symfony将通过您模块的模板文件夹读取名为
_curriculum.php
的部分。最后,您必须在模板文件夹中创建
_curriculum.php
并在此部分中写入代码以创建链接标记:You can use a virtual field in your list, say _curriculum:
So Symfony will read a partial named
_curriculum.php
by the template folder of your module.Finally you have to create
_curriculum.php
in the template folder and write inside this partial the code to create the link tag: