Eclipsed830 Posted May 5, 2019 Share Posted May 5, 2019 Basically my top navigation looks like this currently: And I'd like to move "Network Status" and "Contact Us" to the right side next to the account drop down. So the right looks something like: Contact Us | Network Status | Account ^ I can see the location of this text in header.tpl here: <ul class="nav navbar-nav navbar-right"> {include file="$template/includes/navbar.tpl" navbar=$secondaryNavbar} </ul> But if possible, I'm wondering if I can do this by creating a hook? I'm trying to avoid editing .tpl files and couldn't figure out a hook that would do this properly. :( Thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 19, 2019 Share Posted May 19, 2019 On 05/05/2019 at 08:57, Eclipsed830 said: And I'd like to move "Network Status" and "Contact Us" to the right side next to the account drop down. So the right looks something like: Contact Us | Network Status | Account ^ from a technical point of view, you can't "move" them - you delete them from the primary navbar (left) and recreate them in the secondary navbar (right). On 05/05/2019 at 08:57, Eclipsed830 said: But if possible, I'm wondering if I can do this by creating a hook? I'm trying to avoid editing .tpl files and couldn't figure out a hook that would do this properly. 😞 the easiest way would be with a hook - you could do it in a template if you really had to, but it's unnecessary. <?php # Move Navbar Menu Items Hook # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $client = Menu::context('client'); if (is_null($client) && !is_null($primaryNavbar->getChild('Network Status'))) { $primaryNavbar->removeChild('Network Status'); } if (is_null($client) && !is_null($primaryNavbar->getChild('Contact Us'))) { $primaryNavbar->removeChild('Contact Us'); } }); add_hook('ClientAreaSecondaryNavbar', 1, function (MenuItem $secondaryNavbar) { $client = Menu::context('client'); if (is_null($client)) { $secondaryNavbar->addChild('Contact')->setLabel(Lang::trans('contactus'))->setUri('contact.php')->setOrder(10); $secondaryNavbar->addChild('Network')->setLabel(Lang::trans('networkstatustitle'))->setUri('serverstatus.php')->setOrder(20); } }); so first half removes the current links from the primary navbar; second half adds them to the secondary navbar... i'm also assuming that this is not for loggedin clients (who won't have links to contact.php anyway) - so only those who have not logged in will see these changes. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.