[dev] Group hooks and subgroups

Bernard Blackham b-horde at blackham.com.au
Sat Feb 21 02:48:57 PST 2004


How are group hooks implemented for subgroups? Internally, the
subgroup is represented as 'parent:child', so a function called
'_group_hook_parent:child' would need to be created. As php isn't
terribly happy with this, I ended up replacing colons in the group
name with a double underscore. Hence, the group hooks would instead
be called _group_hook_parent__child. Is there a better solution I've
missed?

Bernard.

diff -u -3 -p -u -r1.4 hooks.php
--- framework/Group/Group/hooks.php	5 Jan 2004 18:59:06 -0000	1.4
+++ framework/Group/Group/hooks.php	21 Feb 2004 10:31:54 -0000
@@ -105,7 +105,7 @@ class Group_hooks extends Group {
      */
     function _getGroupHookName($name)
     {
-        return '_group_hook_' . $name;
+        return '_group_hook_' . str_replace(':', '__', $name);
     }
 
 }


-- 
 Bernard Blackham <bernard at blackham dot com dot au>


More information about the dev mailing list