Here's my code:
<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
if (!is_null($primarySidebar->getChild('Service Details Actions'))) {
$primarySidebar->getChild('Service Details Actions')
->addChild('Check', array(
'label' => 'Checker',
'uri' => 'http://example.com/check/'.print_r($vars['params']['domain']).'-check',
'order' => '3',
));
}
});
I am wanting the uri
to link to here (assuming $domain = testdomain.com):
http://example.com/check/testdomain.com-check
Instead, it is showing this right now:
http://example.com/check/1-check
This is the specific line that I guess I'm having trouble with:
'uri' => 'http://example.com/check/'.print_r($vars['params']['domain']).'-check',
What am I doing wrong here?
The call to print_r() is unnecessary. Assuming that the string "testdomain.com" is stored in $vars['params']['domain'], then you simply need to concatenate the variable with the string like this:
'uri' => 'http://example.com/check/'.$vars['params']['domain'].'-check',
The function print_r() prints readable information about the given variable. Typically it is only used for debugging.