我正在尝试修改一段使用Symfony 2框架生成输入字段的代码。在这种情况下,他使用默认标签创建字段的内容等于字段的名称ID; “量”。
<?php
//++++++++++ descrizione
echo $view['form'] -> row($form["amount"], array(
//widget
"widgetArgs" => array(
"attr" => array(
'class' => 'input-small tooltipRight',
'id' => "gift_amount"
),
"tooltip"=>"gift.tooltip.amount",
"translation_domain" =>"brand"
),
"labelArgs" => array(
"label_attr" => array(
'class' => 'control-label',
)) ,"rowType"=>2
)
);
?>
我如何编辑它以使其显示自定义标签?
答案 0 :(得分:2)
您必须添加label
属性:
<?php
echo $view['form']->row($form["amount"], array(
'widgetArgs' => array(
"attr" => array(
'class' => 'input-small tooltipRight',
'id' => "gift_amount"
),
'tooltip'=>'gift.tooltip.amount',
'translation_domain' =>'brand'
),
'label' => 'My ammount',
));