From 1a969c028cdf3ea1391f7607f8f09e4ae27a4ebf Mon Sep 17 00:00:00 2001 From: Roger Date: Fri, 5 Jan 2024 17:10:43 +0000 Subject: [PATCH 1/3] Columns functionality for \Magento\Theme\Block\Html\Topmenu seems broken --- app/code/Magento/Theme/Block/Html/Topmenu.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Theme/Block/Html/Topmenu.php b/app/code/Magento/Theme/Block/Html/Topmenu.php index f8460b43ba2ff..2ce3b54ffd7d0 100644 --- a/app/code/Magento/Theme/Block/Html/Topmenu.php +++ b/app/code/Magento/Theme/Block/Html/Topmenu.php @@ -141,7 +141,7 @@ protected function _columnBrake($items, $limit) { $total = $this->_countItems($items); if ($total <= $limit) { - return; + return []; } $result[] = ['total' => $total, 'max' => (int)ceil($total / ceil($total / $limit))]; @@ -151,12 +151,9 @@ protected function _columnBrake($items, $limit) foreach ($items as $item) { $place = $this->_countItems($item->getChildren()) + 1; - $count += $place; + $count++; - if ($place >= $limit) { - $colbrake = !$firstCol; - $count = 0; - } elseif ($count >= $limit) { + if ($count > $limit) { $colbrake = !$firstCol; $count = $place; } else { @@ -242,7 +239,7 @@ protected function _getHtml( } if ($this->shouldAddNewColumn($colBrakes, $counter)) { - $html .= '