21-1 プラグインの概要
399ページ
name: Example
id: Example
description: This is sample plugin.
author_name: foo
author_link: http://user-domain/
doc_link: http://user-domain/document/
plugin_link: http://user-domain/plugins/
version: 1.0
blog_config_template: config.tmpl
settings:
my_setting_number:
default: 100
scope: blog
schema_version: 1.0
object_types:
product: Example::Product
tags:
block:
Examples: $Example::Example::Tags::_hdlr_examples
ifExample: $Example::Example::Tags::_hdlr_if_example
function:
ExampleName: $Example::Example::Tags::_hdlr_example_name
modifier:
add_example: $Example::Example::Tags::_fltr_add_example
applications:
cms:
methods:
list_product: $Example::Example::CMS::list_product
edit_product: $Example::Example::CMS::edit_product
callbacks:
MT::App::CMS::cms_pre_save.entry: $Example::Example::CMS::_pre_save_entry
400ページ
package MT::Plugin::Example;
use strict;
use base qw( MT::Plugin );
our $VERSION = '1.0';
my $plugin = __PACKAGE__->new({
name => 'Example',
id => 'Example',
description => 'This is sample plugin.',
author_name => 'foo',
author_link => 'http://user-domain/',
version => $VERSION,
});
MT->add_plugin($plugin);
sub init_registry {
my $plugin = shift;
$plugin->registry({
tags => {
block => {
'Templates' => \&_hdlr_templates,
},
},
callbacks => {
'MT::App::CMS::template_source.edit_entry' => \&_edit_entry,
'MT::App::CMS::template_param.edit_entry' => \&_get_param,
},
});
}
sub _hdlr_templates {
...中略...
}
...中略...
1;