wulfric Posted March 24, 2017 Share Posted March 24, 2017 How do I make a list item link have added arrays like target and title? <a href="uri" title="link stuff goes here" target="_blank">label</a> Here is the code I ripped from the docs and a few other links, but I need your help so I can get results! <?php use WHMCS\View\Menu\Item; add_hook('ClientAreaHomepagePanels', 1, function($homePagePanels) { $newPanel = $homePagePanels->addChild( 'helpful-links', array( 'name' => 'Helpful Links', 'label' => 'Helpful Links', 'icon' => 'fa-pie-chart', 'order' => '10', // 'extras' => array( // 'btn-link' => '/xyz', // 'btn-text' => 'Resource', // ), ) ); $newPanel->addChild( 'helpful-page', array( 'label' => 'Goto a <u>helpful page</u> to check guides and stuff', 'uri' => '/abc', 'order' => 10, '[b]target[/b]' => 'blank', '[b]title[/b]' => 'link title here', ) ); }); https://developers.whmcs.com/hooks/hook-index/ http://docs.whmcs.com/Working_With_Client_Area_Home_Page_Panels https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareahomepagepanels 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 24, 2017 Share Posted March 24, 2017 try doing something like this... <?php # HomePagePanel Hook # Written by brian! use WHMCS\View\Menu\Item; add_hook('ClientAreaHomepagePanels', 1, function(Item $homePagePanels) { $html = '<p>Goto a <a href="http://www.google.com" target="_blank">helpful page</a> to check guides and stuff</p>'; $homePagePanels->addChild('Helpful Links', array( 'label' => 'Helpful Links', 'icon' => 'fa-pie-chart', 'order' => 10, 'extras' => array( 'color' => 'blue', 'btn-link' => 'http://www.google.com', 'btn-text' => 'Google', 'btn-icon' => 'fa-google', ), 'bodyHtml' => $html, )); }); that way, if you want to change the body of the panel, you just need to edit $html - so if you want to add lists, you can add them there... if you've got arrays to work with, you can loop their output etc. if you want to do it your way, then you'd do something like this... add_hook('ClientAreaHomepagePanels', 1, function(Item $homePagePanels) { $homePagePanels->addChild('helpful-links', array( 'name' => 'Helpful Links2', 'label' => 'Helpful Links', 'icon' => 'fa-pie-chart', 'order' => '10', ) ); $homePagePanels->getChild('helpful-links') ->addChild('helpful-page', array( 'label' => 'Goto a <u>helpful page</u> to check guides and stuff', 'uri' => '/abc', 'order' => 10, ) ) ->setAttribute("target", "_blank"); }); the big difference between the two is that with mine, only the "helpful page" text is hyperlinked; with yours the entire child is linked. if you wanted to save even more space, you could just drop the bodyhtml and use the link in the top-right of the panel to go to your page... <?php # HomePagePanel Hook # Written by brian! use WHMCS\View\Menu\Item; add_hook('ClientAreaHomepagePanels', 1, function(Item $homePagePanels) { $homePagePanels->addChild('Helpful Links', array( 'label' => 'Helpful Links', 'icon' => 'fa-pie-chart', 'order' => 10, 'extras' => array( 'color' => 'blue', 'btn-link' => 'http://www.google.com', 'btn-text' => 'Google', 'btn-icon' => 'fa-google', ), )); }); 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.