File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ public function clearFilter(string $field = ''): void
7272 $ explodeField = explode ('. ' , $ field );
7373
7474 $ currentArray = &$ this ->filters [$ key ];
75- unset($ currentArray [$ explodeField [0 ]]);
75+
76+ $ this ->removeNestedArrayKey ($ currentArray , $ explodeField [0 ], $ explodeField [1 ]);
7677 }
7778
7879 unset($ this ->filters [$ key ][$ field ]);
@@ -519,4 +520,15 @@ protected function powerGridQueryString(string $prefix = ''): array
519520
520521 return $ queryString ;
521522 }
523+
524+ private function removeNestedArrayKey (array &$ array , string $ parent , string $ child ): void
525+ {
526+ if (isset ($ array [$ parent ][$ child ])) {
527+ unset($ array [$ parent ][$ child ]);
528+ }
529+
530+ if (isset ($ array [$ parent ]) && empty ($ array [$ parent ])) {
531+ unset($ array [$ parent ]);
532+ }
533+ }
522534}
You can’t perform that action at this time.
0 commit comments