Skip to content

Commit

Permalink
Use array_key_last()
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Aug 7, 2024
1 parent 759d160 commit 7ef91c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Page/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path = '',

uasort($parentArr, [$this, '_sortMenu']);

foreach (array_keys($parentArr) as $key) {
$last = $key;
}
if (isset($last)) {
$last = array_key_last($parentArr);

if (!is_null($last)) {
$parentArr[$last]['last'] = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ protected function _buildMenuArray(?Varien_Simplexml_Element $parent = null, $pa

uasort($parentArr, [$this, '_sortMenu']);

foreach (array_keys($parentArr) as $key) {
$last = $key;
}
if (isset($last)) {
$last = array_key_last($parentArr);

if (!is_null($last)) {
$parentArr[$last]['last'] = true;
}

Expand Down

0 comments on commit 7ef91c1

Please sign in to comment.