How to change menu item position

  • Posts: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks 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: 82823
  • Thank you received: 13370
  • MODERATOR
7 months 3 weeks 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.034 seconds
Powered by Kunena Forum