File tree Expand file tree Collapse file tree 5 files changed +45
-18
lines changed
app/code/Magento/Ui/Component
lib/internal/Magento/Framework/View/Element Expand file tree Collapse file tree 5 files changed +45
-18
lines changed Original file line number Diff line number Diff line change @@ -232,4 +232,12 @@ public function prepareDataSource(array & $dataSource)
232
232
{
233
233
//
234
234
}
235
+
236
+ /**
237
+ * @return array
238
+ */
239
+ public function getDataSourceData ()
240
+ {
241
+ return [];
242
+ }
235
243
}
Original file line number Diff line number Diff line change @@ -23,4 +23,24 @@ public function getComponentName()
23
23
{
24
24
return static ::NAME ;
25
25
}
26
+
27
+ /**
28
+ * @inheritdoc
29
+ */
30
+ public function getDataSourceData ()
31
+ {
32
+ $ dataSource = [];
33
+ $ id = $ this ->getContext ()->getRequestParam ($ this ->getContext ()->getDataProvider ()->getRequestFieldName ());
34
+ if ($ id ) { // case form
35
+ $ this ->getContext ()->getDataProvider ()
36
+ ->addFilter ($ this ->getContext ()->getDataProvider ()->getPrimaryFieldName (), $ id );
37
+ }
38
+ $ data = $ this ->getContext ()->getDataProvider ()->getData ();
39
+ if (isset ($ data [$ id ])) {
40
+ $ dataSource = [
41
+ 'data ' => $ data [$ id ]
42
+ ];
43
+ }
44
+ return $ dataSource ;
45
+ }
26
46
}
Original file line number Diff line number Diff line change @@ -30,4 +30,15 @@ public function getComponentName()
30
30
{
31
31
return static ::NAME ;
32
32
}
33
+
34
+ /**
35
+ * @inheritdoc
36
+ */
37
+ public function getDataSourceData ()
38
+ {
39
+ return [
40
+ 'data ' => $ this ->getContext ()->getDataProvider ()->getData (),
41
+ 'totalCount ' => $ this ->getContext ()->getDataProvider ()->count ()
42
+ ];
43
+ }
33
44
}
Original file line number Diff line number Diff line change @@ -206,25 +206,8 @@ public function getDataProvider()
206
206
*/
207
207
public function getDataSourceData (UiComponentInterface $ component )
208
208
{
209
- $ dataSource = [];
210
- $ id = $ this ->getRequestParam ($ this ->getDataProvider ()->getRequestFieldName ());
211
- if ($ id ) { // case form
212
- $ this ->getDataProvider ()->addFilter ($ this ->getDataProvider ()->getPrimaryFieldName (), $ id );
213
- $ data = $ this ->getDataProvider ()->getData ();
214
- if (isset ($ data [$ id ])) {
215
- $ dataSource = [
216
- 'data ' => $ data [$ id ]
217
- ];
218
- }
219
- } else { // case listing
220
- $ dataSource = [
221
- 'data ' => $ this ->getDataProvider ()->getData (),
222
- 'totalCount ' => $ this ->getDataProvider ()->count ()
223
- ];
224
- }
225
-
209
+ $ dataSource = $ component ->getDataSourceData ();
226
210
$ this ->prepareDataSource ($ dataSource , $ component );
227
-
228
211
$ dataProviderConfig = $ this ->getDataProvider ()->getConfigData ();
229
212
return [
230
213
$ this ->getDataProvider ()->getName () => [
Original file line number Diff line number Diff line change @@ -116,4 +116,9 @@ public function prepare();
116
116
* @return void
117
117
*/
118
118
public function prepareDataSource (array & $ dataSource );
119
+
120
+ /**
121
+ * @return array
122
+ */
123
+ public function getDataSourceData ();
119
124
}
You can’t perform that action at this time.
0 commit comments