Hi,
I'm writing this post because i have problems when i use my hook.
I have tested all the things we can do with hooks and I have the same ending and a similar errors .
For an exemple and show you what was the problem, I took the hook who can move down an child item.
That doesn't work corretly and the site crashes.
I'm putting here the error message :
Error: Call to a member function getChild() on null in /var/www/html/includes/hooks/testhook.php:6
Stack trace:
#0 /var/www/html/vendor/whmcs/whmcs-foundation/lib/Hook/Manager.php(0): WHMCS\Utility\SafeInclude::{closure}()
#1 /var/www/html/vendor/illuminate/support/Facades/Facade.php(261): WHMCS\Hook\Manager->run()
#2 /var/www/html/includes/functions.php(0): Illuminate\Support\Facades\Facade::__callStatic()
#3 /var/www/html/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): run_hook()
#4 /var/www/html/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\ClientArea->outputWithoutExit()
#5 /var/www/html/vendor/whmcs/whmcs-foundation/lib/Http/Message/AbstractViewableResponse.php(0): WHMCS\ClientArea->getOutputContent()
#6 /var/www/html/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(41): WHMCS\Http\Message\AbstractViewableResponse->getBody()
#7 /var/www/html/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(31): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emitBody()
#8 /var/www/html/clientarea.php(0): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit()
#9 {main}
I followed this doc https://developers.whmcs.com/themes/navigation/
I'm entering correctly the name of menu items but I don't know why that doesn't works.
Here is my code if somebody could help me :
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
$primarySidebar->getChild('Account')->getChild('Edit Account Details')->moveUp();
});