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)
331331 if ($ total <= $ limit ) {
332332 return ;
333333 }
334+ $ result = [];
334335 $ result [] = ['total ' => $ total , 'max ' => ceil ($ total / ceil ($ total / $ limit ))];
335336 $ count = 0 ;
337+ $ itemCount = 0 ;
338+ $ nextColBrake = false ;
336339 foreach ($ items as $ item ) {
337340 $ place = $ this ->_countItems ($ item ->getChildren ()) + 1 ;
341+ $ colbrake = false ;
342+ $ itemCount ++;
338343 $ 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 ' ]) {
340348 $ colbrake = true ;
341349 $ count = 0 ;
342350 } elseif ($ count - $ result [0 ]['max ' ] > $ limit - $ result [0 ]['max ' ]) {
343351 $ colbrake = true ;
344352 $ count = $ place ;
345- } else {
346- $ colbrake = false ;
347353 }
354+
355+ $ nextColBrake = false ;
356+ if ($ itemCount == 1 && $ colbrake ) {
357+ $ nextColBrake = true ;
358+ }
359+
348360 $ result [] = ['place ' => $ place , 'colbrake ' => $ colbrake ];
349361 }
350362 return $ result ;
You can’t perform that action at this time.
0 commit comments