我想渲染原始表单标签,我有以下表单实体类型
$builder
->add('subscriptionBilling', 'entity', array(
'class' => 'AppBundle\Entity\SubscriptionBilling',
'data_class' => 'AppBundle\Entity\SubscriptionBilling',
'choice_label' => function ($allChoices, $currentChoiceKey) {
return '<p>Categories <strong>'.$allChoices->getNoOfCategories().' number</strong> '.$currentChoiceKey.'</p>';
},
'choices' => $options['packages_allowed'],
'data' => $options['selected_subscriptionBilling'],
'multiple' => false,
'expanded' => true,
'required' => true,
'label' => false,
))
;
和我的树枝
{% autoescape false %}
{{form_label(form_categories.subscription.subscriptionBilling)|raw}}
{{form_widget(form_categories.subscription.subscriptionBilling)|raw}}
{% endautoescape %}
但我得到了这个 html
<p>Categories <strong>5 number</strong> 0</p>
<p>Categories <strong>10 number</strong> 1</p>
<p>Categories <strong>25 number</strong> 2</p>
<p>Categories <strong>10 number</strong> 3</p>