Hy there. I'm developing plug-in system and I have problems with call_user_func and referenced variables.
I'm calling plug-in handler like this:
if(PluginFactory::NumberOfPlugins() != 0)
foreach(PluginFactory::GetPlugins() as $pPlugin)
call_user_func(get_class($pPlugin) . "::OnHandlePluggablePart", "Core:AfterSceneAssembly", $Document);
Where $Document
is my document object where I hold my controls. The idea is that plug-ins can modify control set (add, delete, modify). My plugin class is this:
class SomePlugin extends Plugin
{
...
public static function OnHandlePluggablePart($sPart, &$Document)
{
if($sPart == "Core:AfterSceneAssembly")
{
$Document->AddControl(new Paragraph("", "Plugin test"));
}
}
}
Document object is passed by value (copied) not reference... What to do, what to do :) ?