The Movable Type Registry: What it is, and how it works.
The heart of any Movable Type plugin and in Movable Type itself is the Movable Type Registry. Perhaps “heart” is not an apt metaphor. A more accurate comparison might be to the “backbone.” That is because the registry provides the rough outline or skeleton of a plugin by declaring all the template tags, configuration directives, objects, callbacks, and all of its other features as well. From that skeleton we attach the muscles that make things move using Perl.
This skeleton is a expressed in a very simple syntax known as YAML (see the YAML Primer later on in this section) and is found in a single file in your plugin named
config.yaml. Within the
config.yaml file developers express the basic capabilities their plugin exposes in outline form. Let’s look at a simple example:
name: Fluid App id: FluidApp author_link: http://www.majordojo.com/ author_name: Byrne Reese description: This plugin provides enhanced support for Fluid for Mac OS X. version: 0.90 plugin_link: http://www.majordojo.com/projects/mt-fluid-app.php applications: cms: methods: fluid_update: $FluidApp::FluidApp::Plugin::cms_update callbacks: MT::App::CMS::template_source.header: $FluidApp::FluidApp::Plugin::xfrm_hdr
Don’t worry if the above example does not make any sense yet, it is provided simply to introduce you to the syntax or structure of a
config.yaml file. This example actually comes from a real Movable Type plugin - one that provides an integration with the Fluid Application for Mac OS X.
It may not be evident to a non-technical person, but the
config.yaml file above does not define behavior, it simply declares the types of behavior this plugin will exhibit and then points to methods within the plugin’s source code where that behavior is defined.
A Cumulative Registry
An important fact in working with your plugin’s
config.yaml is that you can add as many elements discussed in this guide into a single config.yaml file. In theory you could merge all of the examples discussed in this guide and produce a single uber-example.
So, let’s get you up to speed on YAML.