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.

1 Comment

Any way to make this work in version 3.34?
config.yaml does not exist as far as I can see in that version.
Thanks

Leave a comment

Recent Entries

  • Must Be Doing Something Right

    It’s not because they say please and thank you so often (and appropriately). It’s not that they hug each other and say they’re sorry (eventually)...

  • Because tests and bugs are fun

    A colleague of mine just shared this particular frustration: yargh. my test passes if all of the objects are created within the same second, but...

  • Upgraded to MT 4.23

    So, yeah, it’s a month late or so, but I’ve been really busy. I finally upgraded this site to Movable Type 4.23. Maybe I’ll even...

  • I apologize about the feed updates

    I’m deploying a development version of my MediaConsumer plugin and a number of entries might appear as updated in feed readers as I start applying...

  • 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...

Close