Usage of Dumper for the developer

MT > Dumper

Use it from other plugin.

It is possible to use it from other plugin by the following way.

Example

require MT;
my $app = MT->instance;
my $dumper = $app->component('Dumper');
my %config_hash = (
'dump_entry' => 1,
'dump_entry_yaml' => 1,
'dump_entry_yaml_file' => 'entries.yaml',
'dump_entry_fields' => {
'id' => 'id',               # Outout id field.
'title' => 'name',          # Output title field as name.
'permalink' => 'permalink', # Output Permalink.
'entry_email' => 'email',   # Output Custom Fields field that specified by tagname.
},
);
foreach my $k (keys %config_hash) {
$dumper->set_config_value($k, $config_hash{$k}, 'blog:1');
}
出力例(entries.yaml)

---
1:
id: 1
name: entry's title
permalink: http://tec.toi-planning.net/entry/permalink/
email: taku@toi-planning.net

Leave a Reply