dsf8897 2014-04-28 17:17
浏览 25
已采纳

Symfony2占位符html

I need your help. I have build a form of user registration. I need to add checkbox with this massage: "Accept the terms of use" but the word of "terms" must be link to pdf file. Of course I can't put html tags into translation file because it doesn't work. I could use 'raw' keyword in twig template. But I don't want to doing this. I am thinking about placeholder to do it. But I do not now how to made it form class. Do you have any idea how to do it?

class SupplierAddressFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
         $builder->add('roules_acceptance', 'checkbox', array('label' => 'form.roules_acceptance', 'mapped' => false));
         // ....
    }
}

example of label what I need to made:

Accept the <a href="url_to_pdf">terms</a>
  • 写回答

3条回答 默认 最新

  • doumangzhen7204 2014-05-02 15:56
    关注

    Thx for yours help.

    Finally I sloved it by using twig template. Finally I solved it by using twig template. My example below explain everything:

        <div>
            {{ form_widget(form.sfGuardUserProfile.roulesAcceptance) }}
            {{ 'form.roules_acceptance'| trans | raw }}  {# <---- my answer #}
            {{ form_errors(form.sfGuardUserProfile.roulesAcceptance) }}     
        </div>
        <div>
            {{ form_widget(form.sfGuardUserProfile.allowToUsePersonalData) }}
            {{ form_label(form.sfGuardUserProfile.allowToUsePersonalData) }}
            {{ form_errors(form.sfGuardUserProfile.allowToUsePersonalData) }}     
        </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘