RN2013 Posted November 21, 2023 Share Posted November 21, 2023 Hi All I am trying to figure out a few things regarding hooks. Firstly sorry for probably asking some daft questions. I have managed to hide some sidebar items like the "Contacts" and "My Info" as well as some of the default "homePagePanel" items like Recent News etc. So I have made some progress. I am now left with the "Shortcuts" sidebar. Is it possible to add "login to cPanel" and "login to Webmail" if the client is a hosting client as an example. Also how can I tell the what a "primarySidebar" and a "secondarySidebar" is, is there a reference of what these are? Also in add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) What does the 1 signify, all the examples i have seen seem to be 1, but i am guessing that it may be related to priority, i.e. 1 before 2, before 3 etc Thanks in advance Lyndon 0 Quote Link to comment Share on other sites More sharing options...
RN2013 Posted November 22, 2023 Author Share Posted November 22, 2023 I have done a bit more around this, and have added some menu items to the Shortcuts Menu but these are custom links to external resources like access to a coverage map etc. Does anyone know if it is possible to add a menu item from another menu, to the Shortcuts Menu, as per the original post, I would like to add "Login to cPanel" from the Actions Menu, to the Shortcuts Menu. 0 Quote Link to comment Share on other sites More sharing options...
RN2013 Posted November 22, 2023 Author Share Posted November 22, 2023 I have done a bit more around this, and have added some menu items to the Shortcuts Menu but these are custom links to external resources like access to a coverage map etc. Does anyone know if it is possible to add a menu item from another menu, to the Shortcuts Menu, as per the original post, I would like to add "Login to cPanel" from the Actions Menu, to the Shortcuts Menu. I have tired this and a few variations but I don't have the skills and can't find the supporting documentation to point me in the right direction, some of this code has been picked on the community and from a few examples online add_hook('ClientAreaPrimarySidebar', 2, function (MenuItem $secondarySidebar) { // Get the "Client Shortcuts" menu $clientShortcutsMenu = $secondarySidebar->getChild('Client Shortcuts'); // Get information about the current service $service = Menu::context('service'); $domain = $service->domain; $servertype = $service->product->servertype; // Check if the "Client Shortcuts" menu exists if ($clientShortcutsMenu) { // If the server type is not cPanel, do nothing if ($servertype != "cpanel") { return; } // Check if the "Service Details Actions" menu exists if (!is_null($clientShortcutsMenu->getChild('Actions'))) { // Get Service Details "Login to cPanel" link $clientShortcutsMenu->getChild('Actions') ->getChild('Log in to cPanel') ->addChild('Log in to cPanel'); // Set the URI for the "Login to Webmail" link $clientShortcutsMenu->getChild('Actions') ->getChild('Login to Webmail') ->addChild('Login to Webmail'); } } }); Any assistance would be much appreciated. 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.