Creating plugins in Movable Type, with NO PERL REQUIRED

Not to long ago I began work on a very cool new theme, or Template Set, for Movable Type. I had built out all the templates and nearly completed all of my work without having to write a single line of Perl code, which was one of those unstated design goals for the project because let's face it, no one should have to write a single line of code, be it Perl, PHP, Python or Ruby, to create a theme for any blog and web site. That is outside the skill set of a typical designer.

But then I got to a point in the project where I wanted to surface configuration options to the user for the theme.

Byrne, meet Wall. Wall, meet Byrne. Smack.

That is when the "unstated design goal" permuted into a new proposal and prototype for how Movable Type can be extended in the future to support 100% perl-less plugins. No kidding. The experimental plugin is called "Movable Type Configuration Assistant."

How it Works

Say you are a designer. You want to build a theme for a web site that someone can just drop in to their blog and have it work. You also want to make the theme configurable while keeping your users from having to know anything about HTML, CSS, PHP or Perl themselves. Just fill out a form and be done with it. Here's the challenge: you don't know how to do that because while you know HTML and CSS like the back of your hand, your knowledge of Perl and/or PHP is some what lacking.

Enter Configuration Assistant.

Configuration Assistant for Movable Type allows you to easily design an entire settings page for your theme or plugin complete with field sets, labels, default values, pull down menus, radio buttons, check boxes, text areas, and text input fields for all the options you wish to expose. You can do this all through a simple config file. Did I say that no perl is required?

The settings a user then saves using this form will automatically be made available to you, the designer, through a set of template tags you choose and that you can use within your templates. Here is a simple example:

Here is an excerpt from a Movable Type config.yaml file that will define two settings for your plugin:

id: MyPluginID
name: My Plugin
blog_config_template: '<mt:PluginConfigForm id="MyPluginID">'
plugin_config:
    MyPluginID:
        fieldset_1:
            feedburner_id:
                type: text
                label: "Feedburner ID"
                hint: "This is the name of your Feedburner feed."
                tag: 'MyPluginFeedburnerID'
            use_feedburner:
                type: checkbox
                label: "Use Feedburner?"
                tag: 'IfFeedburner?'

This is the settings page it creates:

Config Assistant Screenshot

And here is the template code that utilizes the tags it auto-creates for you:

<mt:IfFeedburner>
  My feedburner id is <mt:FeedburnerID>.
<mt:Else>
  Feedburner is disabled!
</mt:IfFeedburner>

Documentation

Status of the Plugin

This plugin is a prototype for something I believe strongly should be in the core of Movable Type. I have built this plugin to serve as a working example for a proposal made to the Movable Type Open Source community.

The plugin needs additional refinement before being fully integrated. Namely:

  • this plugin should extend the existing settings registry key as opposed to defining its own plugin_config registry key.
  • this plugin should support additional form elements like radio, multiple checkboxes, and more.
  • simplify the semantics of the configuration options.
  • this plugin needs to be used by users, have its documentation completed, and be more thoroughly tested.
  • this plugin needs endorsements and approval from the community.

Download

I need help testing this concept. Please consider downloading it and playing around with iit:

Recommended Entries

1 Comment

Should that be:

<mt:IfFeedburner>
  My feedburner id is <mt:MyPluginFeedburnerID>.
<mt:Else>

The tag was defined as MyPluginFeedburnerID in the yaml.

Leave a comment

what will you say?


Recent Comments

Close