English 中文(简体)
如何轻松地在交响乐中主题一个选择形式字段的选项?
原标题:How to easily theme one option of a choice form field in Symfony?
  • 时间:2012-05-24 15:12:20
  •  标签:
  • symfony

我目前使用一个选择字段( 选项“ 扩展” 设置为真实) 来显示选择值的无线电按钮列表。 我想改变 < code>$view[ 窗体] - gt;widget () 提供的方式, 并在 < code> src/ MyProject/ ABundle/ Resources/views/ Form/ choice_widget. html.php 中已有另一个无法更改的全局模板 。

如何在 php 视图( 无 twig ) 中指定新的 radio 按钮模板?

最佳回答

在返回时,这是如何容易做到的,但交响乐的官方文件并不清楚。

将您的 choice_widget.html.php 放在 src/ yourproject/ yourBundle/resources/ view/ somethinging/ 中,当您需要用它按下无线电按钮时,请使用 :

<?php $view[ form ]->setTheme($form, array( YourProjectYourBundle:Something )) ?>
<?php echo $view[ form ]->widget($form) ?>

以美方为您的形式视图。

问题回答

暂无回答




相关问题
Symfony 5, I can t start the server

I develop a symfony project and everything was fine. But since yesterday I can not launch the server: enter image description here The commands symfony server:start and symfony server:stop don t work ...

learning symfony 1.4 will be good when using symfony 2.0?

I know that the architecture is different in symfony 2.0 but im learning 1.4 right now. I wonder if this knowledge i gain about 1.4 will be usable for 2.0 in some extent or will it be a total waste ...

Is symfony 2.0 stable enough to use? [closed]

I wonder if Symfony 2.0 is stable enough to use? Because I ve never used Symfony before. It seems that Symfony 2 is much better than the previous version and I don t want to relearn/recode ...

your experience using symfony 2.0 [closed]

I m going to start a new project that s building web apps from scratch. I have been thinking about using symfony framework for this project. Should I start using symfony 2.0 or stick with 1.4 ? I ...

How to increase the session timeout in Symfony

I would like to know how to increase the session timeout in symfony. Is it enough to only adjust the symfony configuration settings or must I also configure anything in my php.ini file?

How stable or unstable is symfony 2.0? [closed]

Well, I know it s a preview, and I know it says that it s not yet ready for production, and yet I dare ask the question. I need to start building a pretty big application, which is planned to go live ...

热门标签