Jump to content

How do i add icons to production detail area sidebars?


Recommended Posts

21 hours ago, HomelessPanda said:

To add icons to the cpanel login and others in the list

in order to do that, you would really need to use an action hook rather than edit any template... specifically you would use setIcon and would need to use either FontAwesome or Glyphicons for the icons (which icons would you want to use for those links?)

https://developers.whmcs.com/themes/sidebars/

Link to comment
Share on other sites

i would like to add fas fa-sign-in-alt fa-fw to both cpanel and webmail login,  fas fa-unlock fa-fw to the change password and fas fa-ban fa-fw to the Request Cancellation.

 

I am also having some issues with my sidebar panel for some reason its pulling it to the left but i want it  to the right and i cant seem to get it fixed. ive been trying for 2 days now with no success, please help 

download (1).png

Link to comment
Share on other sites

On 16/03/2019 at 14:45, HomelessPanda said:

i would like to add fas fa-sign-in-alt fa-fw to both cpanel and webmail login,  fas fa-unlock fa-fw to the change password and fas fa-ban fa-fw to the Request Cancellation.

then the hook would be along the lines of the code below - create a .php file in /includes/hooks and paste the code into it...

<?php

# Add Icons To Service Actions Sidebar Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
	$ActionDetails = $primarySidebar->getChild("Service Details Actions");
	if (empty($ActionDetails)) {
		return;
	}
	$ActionDetailsChildren = $ActionDetails->getChildren();
	$kidsToIcon = ["Login to cPanel","Login to Webmail","Change Password","Cancel"];
	foreach($ActionDetailsChildren as $key => $Action_details_child) {
		if (in_array($key, $kidsToIcon)) {
			if ($key === "Login to cPanel" || $key === "Login to Webmail"){$newicon = "fa-sign-in-alt";}
			elseif ($key === "Change Password"){$newicon = "fa-unlock";}
			elseif ($key === "Cancel"){$newicon = "fa-ban";}
			$ActionDetails->getChild($key)->setIcon($newicon." fa-fw");
		}
	}
});

F30YfZr.png

you can ignore the Upgrade/Downgrade sidebar link if your products don't have upgrade options... if they do, you can easily update the hook to add an icon to it.

<?php

# Add Icons To Service Actions Sidebar Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
	$ActionDetails = $primarySidebar->getChild("Service Details Actions");
	if (empty($ActionDetails)) {
		return;
	}
	$ActionDetailsChildren = $ActionDetails->getChildren();
	$kidsToIcon = ["Login to cPanel","Login to Webmail","Change Password","Upgrade/Downgrade","Cancel"];
	foreach($ActionDetailsChildren as $key => $Action_details_child) {
		if (in_array($key, $kidsToIcon)) {
			if ($key === "Login to cPanel" || $key === "Login to Webmail"){$newicon = "fa-sign-in-alt";}
			elseif ($key === "Change Password"){$newicon = "fa-unlock";}
			elseif ($key === "Cancel"){$newicon = "fa-ban";}
			elseif ($key === "Upgrade/Downgrade"){$newicon = "fa-sort";}
			$ActionDetails->getChild($key)->setIcon($newicon." fa-fw");
		}
	}
});

X4tm7fW.png

On 16/03/2019 at 14:45, HomelessPanda said:

I am also having some issues with my sidebar panel for some reason its pulling it to the left but i want it  to the right and i cant seem to get it fixed. ive been trying for 2 days now with no success, please help 

take a look at the following post for a couple of solutions to this...

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