@@ -18,7 +18,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic
18
18
/**
19
19
* Basic import model
20
20
*
21
- * @var \Magento\ImportExport\Model\ Import
21
+ * @var Import
22
22
*/
23
23
protected $ _importModel ;
24
24
@@ -77,8 +77,10 @@ protected function _prepareForm()
77
77
);
78
78
79
79
// base fieldset
80
- $ fieldsets ['base ' ] = $ form ->addFieldset ('base_fieldset ' , ['legend ' => __ ('Import Settings ' )]);
81
- $ fieldsets ['base ' ]->addField (
80
+ $ fieldsets ['base ' ] = $ form ->addFieldset (
81
+ 'base_fieldset ' ,
82
+ ['legend ' => __ ('Import Settings ' )]
83
+ )->addField (
82
84
'entity ' ,
83
85
'select ' ,
84
86
[
@@ -95,12 +97,11 @@ protected function _prepareForm()
95
97
// add behaviour fieldsets
96
98
$ uniqueBehaviors = $ this ->_importModel ->getUniqueEntityBehaviors ();
97
99
foreach ($ uniqueBehaviors as $ behaviorCode => $ behaviorClass ) {
98
- $ fieldsets [ $ behaviorCode ] = $ form ->addFieldset (
100
+ $ fieldset = $ form ->addFieldset (
99
101
$ behaviorCode . '_fieldset ' ,
100
102
['legend ' => __ ('Import Behavior ' ), 'class ' => 'no-display ' ]
101
103
);
102
- /** @var $behaviorSource \Magento\ImportExport\Model\Source\Import\AbstractBehavior */
103
- $ fieldsets [$ behaviorCode ]->addField (
104
+ $ fieldset ->addField (
104
105
$ behaviorCode ,
105
106
'select ' ,
106
107
[
@@ -116,13 +117,13 @@ protected function _prepareForm()
116
117
'after_element_html ' => $ this ->getImportBehaviorTooltip (),
117
118
]
118
119
);
119
- $ fieldsets [ $ behaviorCode ] ->addField (
120
- $ behaviorCode . \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_VALIDATION_STRATEGY ,
120
+ $ fieldset ->addField (
121
+ $ behaviorCode . Import::FIELD_NAME_VALIDATION_STRATEGY ,
121
122
'select ' ,
122
123
[
123
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_VALIDATION_STRATEGY ,
124
- 'title ' => __ (' ' ),
125
- 'label ' => __ (' ' ),
124
+ 'name ' => Import::FIELD_NAME_VALIDATION_STRATEGY ,
125
+ 'title ' => __ ('Validation Strategy ' ),
126
+ 'label ' => __ ('Validation Strategy ' ),
126
127
'required ' => true ,
127
128
'class ' => $ behaviorCode ,
128
129
'disabled ' => true ,
@@ -133,11 +134,11 @@ protected function _prepareForm()
133
134
'after_element_html ' => $ this ->getDownloadSampleFileHtml (),
134
135
]
135
136
);
136
- $ fieldsets [ $ behaviorCode ] ->addField (
137
- $ behaviorCode . '_ ' . \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_ALLOWED_ERROR_COUNT ,
137
+ $ fieldset ->addField (
138
+ $ behaviorCode . '_ ' . Import::FIELD_NAME_ALLOWED_ERROR_COUNT ,
138
139
'text ' ,
139
140
[
140
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_ALLOWED_ERROR_COUNT ,
141
+ 'name ' => Import::FIELD_NAME_ALLOWED_ERROR_COUNT ,
141
142
'label ' => __ ('Allowed Errors Count ' ),
142
143
'title ' => __ ('Allowed Errors Count ' ),
143
144
'required ' => true ,
@@ -149,11 +150,11 @@ protected function _prepareForm()
149
150
),
150
151
]
151
152
);
152
- $ fieldsets [ $ behaviorCode ] ->addField (
153
- $ behaviorCode . '_ ' . \ Magento \ ImportExport \ Model \ Import::FIELD_FIELD_SEPARATOR ,
153
+ $ fieldset ->addField (
154
+ $ behaviorCode . '_ ' . Import::FIELD_FIELD_SEPARATOR ,
154
155
'text ' ,
155
156
[
156
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_FIELD_SEPARATOR ,
157
+ 'name ' => Import::FIELD_FIELD_SEPARATOR ,
157
158
'label ' => __ ('Field separator ' ),
158
159
'title ' => __ ('Field separator ' ),
159
160
'required ' => true ,
@@ -162,11 +163,11 @@ protected function _prepareForm()
162
163
'value ' => ', ' ,
163
164
]
164
165
);
165
- $ fieldsets [ $ behaviorCode ] ->addField (
166
- $ behaviorCode . \ Magento \ ImportExport \ Model \ Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR ,
166
+ $ fieldset ->addField (
167
+ $ behaviorCode . Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR ,
167
168
'text ' ,
168
169
[
169
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR ,
170
+ 'name ' => Import::FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR ,
170
171
'label ' => __ ('Multiple value separator ' ),
171
172
'title ' => __ ('Multiple value separator ' ),
172
173
'required ' => true ,
@@ -175,11 +176,11 @@ protected function _prepareForm()
175
176
'value ' => Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR ,
176
177
]
177
178
);
178
- $ fieldsets [ $ behaviorCode ] ->addField (
179
- $ behaviorCode . \ Magento \ ImportExport \ Model \ Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT ,
179
+ $ fieldset ->addField (
180
+ $ behaviorCode . Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT ,
180
181
'text ' ,
181
182
[
182
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT ,
183
+ 'name ' => Import::FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT ,
183
184
'label ' => __ ('Empty attribute value constant ' ),
184
185
'title ' => __ ('Empty attribute value constant ' ),
185
186
'required ' => true ,
@@ -188,28 +189,29 @@ protected function _prepareForm()
188
189
'value ' => Import::DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT ,
189
190
]
190
191
);
191
- $ fieldsets [ $ behaviorCode ] ->addField (
192
- $ behaviorCode . \ Magento \ ImportExport \ Model \ Import::FIELDS_ENCLOSURE ,
192
+ $ fieldset ->addField (
193
+ $ behaviorCode . Import::FIELDS_ENCLOSURE ,
193
194
'checkbox ' ,
194
195
[
195
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELDS_ENCLOSURE ,
196
+ 'name ' => Import::FIELDS_ENCLOSURE ,
196
197
'label ' => __ ('Fields enclosure ' ),
197
198
'title ' => __ ('Fields enclosure ' ),
198
199
'value ' => 1 ,
199
200
]
200
201
);
202
+ $ fieldsets [$ behaviorCode ] = $ fieldset ;
201
203
}
202
204
203
205
// fieldset for file uploading
204
- $ fieldsets [ ' upload ' ] = $ form ->addFieldset (
206
+ $ fieldset = $ form ->addFieldset (
205
207
'upload_file_fieldset ' ,
206
208
['legend ' => __ ('File to Import ' ), 'class ' => 'no-display ' ]
207
209
);
208
- $ fieldsets [ ' upload ' ] ->addField (
209
- \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_SOURCE_FILE ,
210
+ $ fieldset ->addField (
211
+ Import::FIELD_NAME_SOURCE_FILE ,
210
212
'file ' ,
211
213
[
212
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_SOURCE_FILE ,
214
+ 'name ' => Import::FIELD_NAME_SOURCE_FILE ,
213
215
'label ' => __ ('Select File to Import ' ),
214
216
'title ' => __ ('Select File to Import ' ),
215
217
'required ' => true ,
@@ -219,11 +221,11 @@ protected function _prepareForm()
219
221
),
220
222
]
221
223
);
222
- $ fieldsets [ ' upload ' ] ->addField (
223
- \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_IMG_FILE_DIR ,
224
+ $ fieldset ->addField (
225
+ Import::FIELD_NAME_IMG_FILE_DIR ,
224
226
'text ' ,
225
227
[
226
- 'name ' => \ Magento \ ImportExport \ Model \ Import::FIELD_NAME_IMG_FILE_DIR ,
228
+ 'name ' => Import::FIELD_NAME_IMG_FILE_DIR ,
227
229
'label ' => __ ('Images File Directory ' ),
228
230
'title ' => __ ('Images File Directory ' ),
229
231
'required ' => false ,
@@ -234,6 +236,7 @@ protected function _prepareForm()
234
236
),
235
237
]
236
238
);
239
+ $ fieldsets ['upload ' ] = $ fieldset ;
237
240
238
241
$ form ->setUseContainer (true );
239
242
$ this ->setForm ($ form );
0 commit comments