Skip to content

Commit

Permalink
Better reordering of menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Aug 15, 2024
1 parent fc902aa commit 6a41deb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/EventSubscriber/OrderShowMenuSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function addEditButton(OrderShowMenuBuilderEvent $event): void
->setLabelAttribute('color', 'purple')
;

$sort = [self::MENU_ITEM_KEY, 'order_history', 'cancel'];
$rest = array_diff(array_keys($menu->getChildren()), $sort);
$sort = array_keys($menu->getChildren());
array_unshift($sort, self::MENU_ITEM_KEY);

try {
$event->getMenu()->reorderChildren(array_merge($sort, $rest));
$event->getMenu()->reorderChildren($sort);
} catch (\InvalidArgumentException) {
}
}
Expand Down

0 comments on commit 6a41deb

Please sign in to comment.