OK, it's been a long day, I'm just back off my hols, and I'm new to this kind of complex JS, so I can't work this one out.
I've got the extdirect code working absolutely fine. But I'm having problems accessing the returned data FROM OUTSIDE THE EXTDIRECT CALL...
Here's the relevant code:
Code:
var plugins = ['plugin1', 'plugin2'];
var input="Anyone there? " ;
var hook='test';
function executeHook(hook, input) {
var output = "";
Ext.php.PluginManager.executeHooks(plugins, hook, input, function(data) {
console.info("DEBUG WITHIN FUNCTION: " + data);
output = data;
});
return output;
}
console.info("RESULT FROM FUNCTION:" + executeHook(hook, input));
Each plugin simply adds a piece of test to the input, in a chain. So the output should be:
"Anyone there? Hello from core; Hello from plugin 2; Hello from plugin 1; "
However, the console has the two output lines as follows:
"RESULT FROM FUNCTION:"
"DEBUG WITHIN FUNCTION: Anyone there? Hello from core; Hello from plugin 2; Hello from plugin 1; "
So the variable data is correct within the ExtDirect call, but how do I get access to the data outside the ExtDirect call?
I've also tried:
Code:
Ext.php.PluginManager.executeHooks(plugins, hook, input, function(data) {
console.info("DEBUG WITHIN FUNCTION: " + data);
return data;
});
But that produces the same result.
Any ideas?
Regards,
Andy