我有一个这样的表格:
$formMapper
->add('formats', 'collection', array(
'type' => new FormatType(),
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'prototype_name' => 'remove'
))
->add('papers', 'collection', array(
'type' => new PaperType(),
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'prototype_name' => 'remove'
))
;
如您所见,我将prototype_name
更改为remove
。
最初它看起来像这样:
当我点击加号时,我得到了这个:
如您所见,添加了remove
文字。但也标签__ *。如何修复此标签__ *文本未添加或显示?
答案 0 :(得分:0)
使用'label_attr' => ['style' => 'display: none']
$formMapper
->add('formats', 'collection', array(
'type' => new FormatType(),
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'label_attr' => ['style' => 'display: none']
))
->add('papers', 'collection', array(
'type' => new PaperType(),
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'label_attr' => ['style' => 'display: none']
))
;
答案 1 :(得分:0)
->add('appointment', CollectionType::class,[
'label' => false,
'entry_type' => AppointmentType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => false,
'prototype' => true,
])
这是我用于添加约会的集合,请参阅 entry_options