Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Plugin_lifecycle_notify & Plugin_has_prefs
Anybody have documentation &/or help for these two plugin options?
PLUGIN_LIFECYCLE_NOTIFY & PLUGIN_HAS_PREFS
Offline
Re: Plugin_lifecycle_notify & Plugin_has_prefs
Not yet, sorry. They will be here when I get my act together. There’s a little bit on the core callbacks page.
Essentially you set the flags you want in your plugin template (or click the relevent checkboxes in the ied_plugin_composer) and add callbacks like this:
register_callback('my_prefs_page', 'plugin_prefs.abc_my_plugin_name');
And for lifecycle management, one or more of:
register_callback('my_install_routine', 'plugin_lifecycle.abc_my_plugin_name', 'installed');
register_callback('my_delete_routine', 'plugin_lifecycle.abc_my_plugin_name', 'deleted');
register_callback('my_enable_routine', 'plugin_lifecycle.abc_my_plugin_name', 'enabled');;
register_callback('my_disable_routine', 'plugin_lifecycle.abc_my_plugin_name', 'disabled');
Last edited by Bloke (2009-09-08 13:39:45)
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: Plugin_lifecycle_notify & Plugin_has_prefs
Ah…I thought there was more to it. In the “core callbacks” it makes them look like they’re some sort of defined variable (with the ALL CAPS, etc)
Offline
Re: Plugin_lifecycle_notify & Plugin_has_prefs
They are.
Background: From Textpattern 4.2.0 on, plugins can opt into receiving plugin_prefs.abc_my_plugin_name
and plugin_lifecycle.abc_my_plugin_name
events. This opt-in is signalled to the core by raising the appropriate bits in $plugin['flags']
.
PLUGIN_LIFECYCLE_NOTIFY
and PLUGIN_HAS_PREFS
are simply human-readable defined bit masks for your coding pleasure. Use them in any appropriate or’ed combination (PLUGIN_LIFECYCLE_NOTIFY | PLUGIN_HAS_PREFS
etc.).
Of note: Textpattern reserves to lower twelve bits of $plugin['flags']
for its own use, plugin authors may take advantage of the remaining four (~PLUGIN_RESERVED_FLAGS
). Might come handy to trigger some one-time actions, as these bits are copied into the txp_plugin
table row for any particular plugin whenever it is uploaded.
Offline