Minimalist plugins are fun!

Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff the entire thing into the plugin configuration file, config.yaml. It adds a configuration option for mt-config.cgi that will pre-populate the path field in the asset upload page.

name: Default Upload Directory
id: DefaultUploadDirectory
version: 0.1
description: Sets the default upload directory

config_settings:
        DefaultUploadDirectory:
                default: assets

callbacks:
        MT::App::CMS::template_param.asset_upload: >>
          sub { $_[2]->{extra_path} = $_[1]->{cfg}->DefaultUploadDirectory }

Drop this into mt-dir/plugins/DefaultUploadDirectory/config.yaml and make use of the new config setting DefaultUploadDirectory in your mt-config.cgi file if the default value of assets isn’t going to work for you.

Leave a comment

Recent Entries

  • Plugin Writing 101

    So, I’m planning on writing up some entries about various aspects of plugin development. While I have a couple topics already in mind, I thought...

  • The Olympics Make Me Want To Compete Again

    Every time the Olympics come around (most the summer ones) I always start to delude myself into thinking I could complete once again in the...

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

Close