How to change menu item position

  • Posts: 122
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
2 weeks 6 days ago #360015

Hi,
on the Control Panel left menu, i would like to reposition Download menu right below Customer Account menu - how can i do it?
I have lates Joomla 5 and Latest Hikashop

Image attached

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81428
  • Thank you received: 13058
  • MODERATOR
2 weeks 6 days ago #360016

Hi,

You'll need to write custom PHP code in the file user / cpanel for your frontend template via the menu Display>Views.
Something like that at the beginning should do it:

<?php
function repositionArrayElement(array &$array, $key, int $order): void
{
    if(($a = array_search($key, array_keys($array))) === false){
        return;
    }
    $p1 = array_splice($array, $a, 1);
    $p2 = array_splice($array, 0, $order);
    $array = array_merge($p2, $p1, $array);
}
repositionArrayElement($this->buttons, 'download', 1);
?>

This is based on this: stackoverflow.com/a/63329352
Note that I haven't tested it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum