File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
app/code/Magento/Backend/Block Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -331,20 +331,32 @@ protected function _columnBrake($items, $limit)
331
331
if ($ total <= $ limit ) {
332
332
return ;
333
333
}
334
+ $ result = [];
334
335
$ result [] = ['total ' => $ total , 'max ' => ceil ($ total / ceil ($ total / $ limit ))];
335
336
$ count = 0 ;
337
+ $ itemCount = 0 ;
338
+ $ nextColBrake = false ;
336
339
foreach ($ items as $ item ) {
337
340
$ place = $ this ->_countItems ($ item ->getChildren ()) + 1 ;
341
+ $ colbrake = false ;
342
+ $ itemCount ++;
338
343
$ count += $ place ;
339
- if ($ place - $ result [0 ]['max ' ] > $ limit - $ result [0 ]['max ' ]) {
344
+ if ($ nextColBrake ) {
345
+ $ colbrake = true ;
346
+ $ count = $ place ;
347
+ } elseif ($ place - $ result [0 ]['max ' ] > $ limit - $ result [0 ]['max ' ]) {
340
348
$ colbrake = true ;
341
349
$ count = 0 ;
342
350
} elseif ($ count - $ result [0 ]['max ' ] > $ limit - $ result [0 ]['max ' ]) {
343
351
$ colbrake = true ;
344
352
$ count = $ place ;
345
- } else {
346
- $ colbrake = false ;
347
353
}
354
+
355
+ $ nextColBrake = false ;
356
+ if ($ itemCount == 1 && $ colbrake ) {
357
+ $ nextColBrake = true ;
358
+ }
359
+
348
360
$ result [] = ['place ' => $ place , 'colbrake ' => $ colbrake ];
349
361
}
350
362
return $ result ;
You can’t perform that action at this time.
0 commit comments