Events and Movable Type Callbacks
Movable Type exposes to developers a number of different “hooks” during the life-cycle of a request that a developer can attach their code to. In a sense, these hooks give plugins the opportunity to inject code and operations into the core of Movable Type’s application logic. This allows plugins to perform more advanced operations than Movable Type might otherwise perform on its own, while preventing developers from having to hack Movable Type’s source code directly.
This section will discuss in detail how to listen for these events, how to attach callbacks for those events, and how to trigger events of your own.
What is an event?
For those unfamiliar with the concepts of an event, let’s have a brief primer on the concept.
The most basic definition of an event could be, “a occurrence within a system that may be of relevance to applications extending it.” The most common form of an event can be found in your own operating system: a mouse click.
When you click your mouse, the operating system “fires” an event. All applications are then notified of that event, and if they are “listening” for it (determined by the application having registered a “listener” or “callback” for it), they will be given the opportunity to take action in response to it. In the meantime they will be given important details about the event (did they double click, where did they click, etc) to facilitate the creation of the desired response.
What an application does in response to an event is completely up to the developer.