我正在嘗試構建一個表單并提出語言選擇。當用戶想要添加多種語言時,我希望此選擇重復。
我的問題是:是否可以將 CollectionType 與 LanguageType 類一起使用?
謝謝你。
uj5u.com熱心網友回復:
是的,一點沒錯。
查看檔案中的示例之一:
$builder->add('emails', CollectionType::class, [
// each entry in the array will be an "email" field
'entry_type' => EmailType::class,
// these options are passed to each "email" type
'entry_options' => [
'attr' => ['class' => 'email-box'],
],
]);
完全由您指定要使用的基礎表單型別,無論是TextType還是LanguageType. 您可以通過entry_options密鑰配置型別。
希望這可以幫助...
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/507524.html
標籤:交响乐
