1 | <?php |
||
37 | class ProductType extends AbstractType |
||
38 | { |
||
39 | /** |
||
40 | * @var Application |
||
41 | */ |
||
42 | public $app; |
||
43 | |||
44 | /** |
||
45 | * ProductType constructor. |
||
46 | * |
||
47 | * @param Application $app |
||
48 | */ |
||
49 | 663 | public function __construct(Application $app) |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 19 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
58 | { |
||
59 | /** |
||
60 | * @var ArrayCollection $arrCategory array of category |
||
61 | */ |
||
62 | 19 | $arrCategory = $this->app['eccube.repository.category']->getList(null, true); |
|
63 | |||
64 | $builder |
||
65 | // 商品規格情報 |
||
66 | 19 | ->add('class', 'admin_product_class', array( |
|
67 | 19 | 'mapped' => false, |
|
68 | )) |
||
69 | // 基本情報 |
||
70 | 19 | ->add('name', 'text', array( |
|
71 | 19 | 'label' => '商品名', |
|
72 | 'constraints' => array( |
||
73 | 19 | new Assert\NotBlank(), |
|
74 | ), |
||
75 | )) |
||
76 | 19 | ->add('product_image', 'file', array( |
|
77 | 19 | 'label' => '商品画像', |
|
78 | 'multiple' => true, |
||
79 | 'required' => false, |
||
80 | 'mapped' => false, |
||
81 | )) |
||
82 | 19 | ->add('description_detail', 'textarea', array( |
|
83 | 19 | 'label' => '商品説明', |
|
84 | )) |
||
85 | 19 | ->add('description_list', 'textarea', array( |
|
86 | 19 | 'label' => '商品説明(一覧)', |
|
87 | 'required' => false, |
||
88 | )) |
||
89 | 19 | ->add('Category', 'entity', array( |
|
90 | 19 | 'class' => 'Eccube\Entity\Category', |
|
91 | 19 | 'property' => 'NameWithLevel', |
|
92 | 19 | 'label' => '商品カテゴリ', |
|
93 | 'multiple' => true, |
||
94 | 'mapped' => false, |
||
95 | // Choices list (overdrive mapped) |
||
96 | 19 | 'choices' => $arrCategory, |
|
97 | )) |
||
98 | |||
99 | // 詳細な説明 |
||
100 | 19 | ->add('Tag', 'tag', array( |
|
101 | 19 | 'required' => false, |
|
102 | 'multiple' => true, |
||
103 | 'expanded' => true, |
||
104 | 'mapped' => false, |
||
105 | )) |
||
106 | 19 | ->add('search_word', 'textarea', array( |
|
107 | 19 | 'label' => "検索ワード", |
|
108 | 'required' => false, |
||
109 | )) |
||
110 | // サブ情報 |
||
111 | 19 | ->add('free_area', 'textarea', array( |
|
112 | 19 | 'label' => 'サブ情報', |
|
113 | 'required' => false, |
||
114 | )) |
||
115 | |||
116 | // 右ブロック |
||
117 | 19 | ->add('Status', 'disp', array( |
|
118 | 'constraints' => array( |
||
119 | 19 | new Assert\NotBlank(), |
|
120 | ), |
||
121 | )) |
||
122 | 19 | ->add('note', 'textarea', array( |
|
123 | 19 | 'label' => 'ショップ用メモ帳', |
|
124 | 'required' => false, |
||
125 | )) |
||
126 | |||
127 | // タグ |
||
128 | 19 | ->add('tags', 'collection', array( |
|
129 | 19 | 'type' => 'hidden', |
|
130 | 'prototype' => true, |
||
131 | 'mapped' => false, |
||
132 | 'allow_add' => true, |
||
133 | 'allow_delete' => true, |
||
134 | )) |
||
135 | // 画像 |
||
136 | 19 | ->add('images', 'collection', array( |
|
137 | 19 | 'type' => 'hidden', |
|
138 | 'prototype' => true, |
||
139 | 'mapped' => false, |
||
140 | 'allow_add' => true, |
||
141 | 'allow_delete' => true, |
||
142 | )) |
||
143 | 19 | ->add('add_images', 'collection', array( |
|
144 | 19 | 'type' => 'hidden', |
|
145 | 'prototype' => true, |
||
146 | 'mapped' => false, |
||
147 | 'allow_add' => true, |
||
148 | 'allow_delete' => true, |
||
149 | )) |
||
150 | 19 | ->add('delete_images', 'collection', array( |
|
151 | 19 | 'type' => 'hidden', |
|
152 | 'prototype' => true, |
||
153 | 'mapped' => false, |
||
154 | 'allow_add' => true, |
||
155 | 'allow_delete' => true, |
||
156 | )) |
||
157 | ; |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * {@inheritdoc} |
||
162 | */ |
||
163 | public function configureOptions(OptionsResolver $resolver) |
||
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | 663 | public function getName() |
|
174 | } |
||
175 |