Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[Solved] Get callback related variables
Hi,
Is there an obvious reason why $newname
would be undefined when trying to register a function on the page_saved event?
class abc_my_plugin
{
public function __construct()
{
register_callback(array($this, 'test'), 'page_saved');
}
public function test($event, $step, $pre, $name, $newname)
{
…
}
}
new abc_my_plugin();
Thanks for your help!
Last edited by NicolasGraph (2017-10-20 10:29:41)
Offline
Offline
Re: [Solved] Get callback related variables
Yeah, ‘pre’ is used when setting up the register_callback to tell it when it should be raised, pre- or post-operation. It’s not passed in the function signature, as the implication is “You (plugin author) raised the callback, so you should know how to treat it”.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [Solved] Get callback related variables
Bloke wrote #307459:
Yeah, ‘pre’ is used when setting up the register_callback to tell it when it should be raised, pre- or post-operation. It’s not passed in the function signature […]
It makes sense but I didn’t realize before, thanks for the explanation.
Offline