Movable Type Callback Reference
The following guide has been assembled as a reference for creating callbacks in Movable Type. If you are unfamiliar with callbacks, what they are and how the function, please read "Events and Movable Type Callbacks."
Quick Review
As Movable Type operates, events within the system are constantly occurring. Some plugins may want to be notified in some fashion when these events happen, and be passed information about the event so that they can respond properly. To do so, a developer needs to register a handler, also known as a callback, via the Movable Type registry. Here is a sample config.yaml file that registers a handler for a fictional event:
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin for Movable Type.
version: 1.0
callbacks:
CallBackName: $Example::Example::Plugin::my_callback
The developer then needs to implement the handler in their plugin. For the above example, a developer would create the following Plugin.pm:
package Example::Plugin;
use strict;
use MT 4;
sub my_callback {
my ($cb, ...) = @_;
return $cb->error("Error message");
}
}
The parameters passed to the callback vary depending upon the event for which the callback is associated. The expected return value from the callback also depends upon the event that has occurred. The following appendix outlines each of the major categories of callbacks that can be registered, their input parameters, and their expected return values.
This page is part of the Events and Callbacks in Movable Type
Leave a note
Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.