FWでSymfony2を使用し、TemplateエンジンでTwigを使用しております。
下記の様にFormを設定
lang
1 public function buildForm(FormBuilderInterface $builder, array $options) { 2 $choices = array( 3 'Europe' => array('France' => 'France', 'Spain' => 'Spain', 'Italy' => 'Italy'), 4 'America' => array('USA' => 'USA', 'Canada' => 'Canada', 'Brazil' => 'Brazil'), 5 ); 6 $builder->add('categoryId', 'choice', array( 7 'label' => 'カテゴリ設定', 8 'choices' => $choices, 9 'required' => FALSE, 10 'expanded' => true, 11 'multiple' => true, 12 'invalid_message' => 'カテゴリ設定の選択が不正です。', 13 )) 14 ; 15 }
Twig側で下記の様に出力したいのですが、どの様に記載すればよろしいでしょうか?
Europe
France←チェックボックス
Spain
Italy
America
USA
Canada
Brazil
Brazil
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。