Skip to content

Commit b67eb5f

Browse files
committed
#37812: Fixed creating submenu if containing more than 12 items (added a column brake)
1 parent 2932016 commit b67eb5f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

app/code/Magento/Backend/Block/Menu.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)