1

I have got sample code as above

add_hook('AdminAreaHeadOutput', 1, function($vars) {
   return "some String";
})

Source of code: https://developers.whmcs.com/hooks-reference/output/#adminareaheadoutput

It is possible to call class method instead anonymous function ?

Something like that :

$myClass = new myclass();
add_hook('AdminAreaHeadOutput', 1, $myClass->AdminAreaHeadOutput($vars));

It is possible to pass anonymous function args to class method ?

1
  • Do you pass the variables immediately or the callback passes them to the function itself? Commented Mar 18, 2017 at 9:39

1 Answer 1

1

Yest it is possible ;)

add_hook('AdminAreaHeadOutput', 1, function($vars){

$myClass = new MyClass();
return $myClass->AdminAreaHeadOutput($vars);

});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.