refactor(core): ♻️ reset sidebar index after for loop

This commit is contained in:
alistair3149 2023-02-16 13:42:01 -05:00
parent f08f640240
commit 33e37f5857
No known key found for this signature in database

View file

@ -69,8 +69,6 @@ final class Drawer extends Partial {
// Remove toolbox since it is handled by page tools // Remove toolbox since it is handled by page tools
case 'p-tb': { case 'p-tb': {
unset( $sidebarData['array-portlets-rest'][$i] ); unset( $sidebarData['array-portlets-rest'][$i] );
// Reset index after unsetting toolbox
$sidebarData['array-portlets-rest'] = array_values( $sidebarData['array-portlets-rest'] );
break; break;
} }
@ -82,6 +80,9 @@ final class Drawer extends Partial {
} }
} }
// Reset index after unsetting toolbox
$sidebarData['array-portlets-rest'] = array_values( $sidebarData['array-portlets-rest'] );
return $sidebarData; return $sidebarData;
} }