File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ class MegaMenuBuilder {
7070 */
7171 public function build ($ item , int $ cols ) {
7272 $ columns_data = [];
73+ // Reset variables on build.
74+ $ this ->split = FALSE ;
75+ $ this ->splitId = '' ;
76+ $ this ->splitAmount = 0 ;
77+ $ this ->panelData = [];
78+ $ this ->total = 0 ;
7379
7480 // If there are no child menu items then exit. It is only 1 menu item and we
7581 // can build a mega menu panel from 1 menu item.
@@ -172,10 +178,6 @@ protected function checkSplit(array $items): bool {
172178
173179 // Only columns bigger then 2 can have a split column.
174180 if ($ this ->cols <= 2 ) {
175- $ this ->split = FALSE ;
176- $ this ->splitId = '' ;
177- $ this ->splitAmount = 0 ;
178-
179181 return FALSE ;
180182 }
181183
@@ -186,10 +188,6 @@ protected function checkSplit(array $items): bool {
186188 $ after = array_key_last ($ items ) != $ split_id ;
187189 // Has items before and after then don't split.
188190 if ($ before & $ after ) {
189- $ this ->split = FALSE ;
190- $ this ->splitId = '' ;
191- $ this ->splitAmount = 0 ;
192-
193191 return FALSE ;
194192 }
195193 }
You can’t perform that action at this time.
0 commit comments