brian! Posted September 24, 2015 Share Posted September 24, 2015 (edited) ok i've figured this out - i'm never sure if this is the "correct" way, but it does seem to work. looking at the secondary navbar (login), it seems as though the divider was using a different css class - that was the clue I needed... then it was just a case of using setClass to define the class for the child. so as an example, i've modified the contact us navbar link - added a child; added a separator child & defined the css class; and then added another child... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Contact Us'))) { $primaryNavbar->getChild('Contact Us') ->addChild('Emergency Contacts', array( 'label' => 'Emergency Contacts', 'uri' => 'emergency.php', 'order' => '100', )); $primaryNavbar->getChild('Contact Us') ->addChild('Divider', array( 'order' => '200', )) ->setClass('nav-divider'); $primaryNavbar->getChild('Contact Us') ->addChild('Phone Home', array( 'label' => 'Phone Home', 'uri' => 'emergency.php', 'order' => '300', )); } }); hopefully, you can add the divider section of the code above to suit your needs. Edited September 24, 2015 by brian! 1 Quote Link to comment Share on other sites More sharing options...
gbotica Posted November 5, 2015 Share Posted November 5, 2015 Thanks - how does one open ->setUri('https://www.example.com/') in a new window? I would like to work this out too? Did you find a solution? 0 Quote Link to comment Share on other sites More sharing options...
gbotica Posted November 5, 2015 Share Posted November 5, 2015 I figured it out... ->setAttribute('target', '_blank'); 0 Quote Link to comment Share on other sites More sharing options...
IWN Group LLC Posted February 28, 2016 Share Posted February 28, 2016 Hello, is there any way to edit the URL behind the Home Button of the Primary Nav? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 28, 2016 Share Posted February 28, 2016 Hello, is there any way to edit the URL behind the Home Button of the Primary Nav? This is how you can do it basically <?php use WHMCS\View\Menu\Item as MenuItem; add_hook("ClientAreaPrimaryNavbar", 1, function (MenuItem $primaryNavbar){ if (!is_null($primaryNavbar->getChild('Home'))){ $primaryNavbar->getChild('Home') ->setUri('https://www.example.com/'); } }); 0 Quote Link to comment Share on other sites More sharing options...
IWN Group LLC Posted February 28, 2016 Share Posted February 28, 2016 Many thanks for this fast help....a last question today: is it also possible to rename the Home Button ? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 28, 2016 Share Posted February 28, 2016 Many thanks for this fast help....a last question today: is it also possible to rename the Home Button ? yes, using the setLabel method as below <?php use WHMCS\View\Menu\Item as MenuItem; add_hook("ClientAreaPrimaryNavbar", 1, function (MenuItem $primaryNavbar){ if (!is_null($primaryNavbar->getChild('Home'))){ $primaryNavbar->getChild('Home') ->setLabel('Home Page') ->setUri('https://www.example.com/'); } }); 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.