Event Handlers

Once you have registered a callback in your config.yaml file you will need to implement the callback in your Plugin.pm file.

One very important thing to note is that the inputs into your callback handler will vary greatly depending upon the event being fired. Consult Appendix B: Movable Type Callbacks Reference for a complete list of events and their callback signatures.

Here is a code sample corresponding to the config.yaml above:

package Example::Plugin;
use strict;
sub pre_save_filter {
    my ($cb, $obj) = @_;
    # $cb - holds a reference to the callback object
    # $obj - holds a reference to the object about to be saved
    #        do your thing
}
This page was last updated on 2008-09-17, 14:41.  

Leave a note

Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation. Your note may be removed once it's contents has be integrated into the body of the page.