我正在尝试添加带有幻灯片集合的轮播,但无法设置嵌入表单的样式。我的原型跳过了表单中的一些类属性。 文档在这里
我的轮播类型:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('slides', CollectionType::class, [
'entry_type' => SlideType::class,
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'by_reference' => false
]);
}
我的幻灯片类型:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, [
'attr' => [
'class' => 'form-control'
],
'required' => false
])
->add('url', UrlType::class, [
'attr' => [
'class' => 'form-control'
],
'required' => false
])
->add('file', FileType::class);
}
多么新的添加表单显示:
<div class="slide">
<div id="carousel_slides_3">
<div>
<label for="carousel_slides_3_title">Title</label>
<input type="text" id="carousel_slides_3_title" name="carousel[slides][3][title]" class="form-control">
</div>
<div>
<label for="carousel_slides_3_url">Url</label>
<input type="text" id="carousel_slides_3_url" name="carousel[slides][3][url]" class="form-control" inputmode="url">
</div>
<div>
<label for="carousel_slides_3_file" class="required">File</label>
<input type="file" id="carousel_slides_3_file" name="carousel[slides][3][file]" required="required">
</div>
</div>
</div>
新表单不显示class="form-group"属性。
我的配置或 javascript 有什么问题?
RISEBY
相关分类