Not a developer? Go to MovableType.com

Documentation

Movable Type Callback Reference

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.

Back

Leave a Comment