Jump to content

Add icon to whmcs primary navbar menu


avatco

Recommended Posts

hi

how can i add icons ( fontawesome icons ) to menu items

add icon next to main menu item like home, announcement, contact us, support and ...

 

can u please send me a example hook code for ?

i can not find anything usefull in WHMCS documents

Link to comment
Share on other sites

you can either use setIcon as described below if modifying an existing menu item...

 

http://forum.whmcs.com/showthread.php?107583-Hook-to-add-icons-to-primaryNavbar-for-six-template&p=441571#post441571

 

or specify it in the array when creating a menu item...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function(MenuItem $primaryNavbar)
{
   $primaryNavbar->addChild('testlink', array(
                   'label' => 'Test Link',
                   'uri' => 'http://www.google.com',
                   'icon' => 'fa-rss',
                   'order' => 250));
});

Link to comment
Share on other sites

thanks for you help !

 

i use this code for all menus :

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function(MenuItem $primaryNavbar)
{
   if (!is_null($primaryNavbar->getChild('Home'))) {
             $primaryNavbar->getChild('Home')
                           ->setIcon('fa-home');
   }

   if (!is_null($primaryNavbar->getChild('Services'))) {
             $primaryNavbar->getChild('Services')
                           ->setIcon('fa-bars');
   }

   if (!is_null($primaryNavbar->getChild('Domains'))) {
             $primaryNavbar->getChild('Domains')
                           ->setIcon('fa-globe');
   }    

   if (!is_null($primaryNavbar->getChild('Billing'))) {
             $primaryNavbar->getChild('Billing')
                           ->setIcon('fa-credit-card');
   }    

   if (!is_null($primaryNavbar->getChild('Support'))) {
             $primaryNavbar->getChild('Support')
                           ->setIcon('fa-support');
   }    

    if (!is_null($primaryNavbar->getChild('Open Ticket'))) {
             $primaryNavbar->getChild('Open Ticket')
                           ->setIcon('fa-ticket');
   }  

if (!is_null($primaryNavbar->getChild('Announcements'))) {
             $primaryNavbar->getChild('Announcements')
                           ->setIcon('fa-newspaper-o');
   }  


if (!is_null($primaryNavbar->getChild('Contact Us'))) {
             $primaryNavbar->getChild('Contact Us')
                           ->setIcon('fa-phone');
   }

if (!is_null($primaryNavbar->getChild('Network Status'))) {
             $primaryNavbar->getChild('Network Status')
                           ->setIcon('fa-plug');
   } 

if (!is_null($primaryNavbar->getChild('Knowledgebase'))) {
             $primaryNavbar->getChild('Knowledgebase')
                           ->setIcon('fa-mortar-board');
   } 

}); 

 

and just one more question ?

how can i set icon for sub menus like invoces , cart , downloads and more ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated