我想改变 $view['form']->widget() 呈现的方式,并且已经在 src/MyProject/ABundle/Resources/views/Form/choice_widget.html.php 中有另一个无法更改的全局模板 .
$view['form']->widget()
src/MyProject/ABundle/Resources/views/Form/choice_widget.html.php
如何在php视图中指定单选按钮的新模板(没有树枝)?
回过头来看,这是如何轻松完成的,但是symfony官方文档还不清楚 .
将 choice_widget.html.php 放入 src/YourProject/YourBundle/Resources/view/Something/ 然后当您需要一个以它为主题的单选按钮时,使用:
choice_widget.html.php
src/YourProject/YourBundle/Resources/view/Something/
<?php $view['form']->setTheme($form, array('YourProjectYourBundle:Something')) ?> <?php echo $view['form']->widget($form) ?>
使用$ form作为表单视图 .
1 回答
回过头来看,这是如何轻松完成的,但是symfony官方文档还不清楚 .
将
choice_widget.html.php
放入src/YourProject/YourBundle/Resources/view/Something/
然后当您需要一个以它为主题的单选按钮时,使用:使用$ form作为表单视图 .