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.