English plugin dev 1 3 - Hiranyaloka/Documentation GitHub Wiki
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
Add it in your plugin’s config.yaml file:
config_settings: MyImageURL: 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
config_settings: MyLogPath: 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
config_settings: MyLogPath: 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)
config_settings: MyErrorLogPath: 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