English plugin dev 1 3

semuel edited this page Nov 7, 2011 · 7 revisions

Adding Configuration directives


Configuration Directive are the basic environment of Movable Type. it defines system-wide defaults, and usually contain things like paths, file names and master – switches to turn on or off a feature globally.
These directives are set in the mt-config.cgi file

Adding a Configuration Directive

Add it in your plugin’s config.yaml file:

        default: http://www.example.com/images/foo.jpg

A configuration directive can have a default, but also these options:

  • path
    • path is boolean (0 or 1) with default 0. If true, this directive is a path and relative paths will be automatically converted to pull paths
        default: /var/log/mt/errors.log
        path: 1
  • handler
    • handler is a dynamic default. instead of using a simple value for default, this default is computed but the specified function
        handler: $Example::Example::Plugin::MyLogPath
        path: 1
  • alias
    • If you change the name of a directive, but fear that existing uses already use the old name, you can specify an alias for it. (in the example below, MyErrorLogPath is an alias for MyLogPath)
        alias: MyLogPath

Configuration Directive can be either a scalar, array or a hash. It can be accessed in your plugin using code as seen in the example below:

use MT;
my $mt = new MT;
my $scalar = $mt->config->ScalarConfig;
my @array = $mt->config->ArrayConfig;
my $hash = $mt->config->HashConfig;


Here we introduced Configuration directive. remember that you should not try to set blog-specific data in such variable, and access to it is rather difficult. (as it is written in the mt-config.cgi file)
There are other config options that can store blog-level, website-level or even system-level settings. please use Configuration directives only for static data that is really server-specific.


Last:Extending the registry using YAML << Index >> Next:Plugin localization

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.