From 5b3f536613d1db389a7194d4ebe4a23505af0573 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 23 Apr 2016 17:47:00 -0700 Subject: updated doco to document how to use hook callbacks which are object methods --- doc/plugins.bb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'doc') diff --git a/doc/plugins.bb b/doc/plugins.bb index f96fb8dee..f2f0b04e8 100644 --- a/doc/plugins.bb +++ b/doc/plugins.bb @@ -264,6 +264,30 @@ we will create an argc/argv list for use by your module functions 3 whatever [/code] +[h3]Using class methods as hook handler functions[/h3] + +To register a hook using a class method as a callback, a couple of things need to be considered. The first is that the functions need to be declared static public so that they are available from all contexts, and they need to have a namespace attached because they can be called from within multiple namespaces. You can then register them as strings or arrays (using the PHP internal calling method). + +[code] +/.hidden -- cgit v1.2.3