<<

NAME

MT::Import

METHODS

import(%param)

This method is called from CMS when user decided to import files in a selected format. This method calls selected importer's method to do actual imports.

register_importer($importer)

This method collects importer from a plugin which requests to add itself to the importer list. Collected information will be used to show the format selection in the dropdown on the Import/Export screen, and actual call to import data from uploaded files.

The information registered as an importer must have the following data in a single hash:

    my $plugin = new Foo::Bar::Plugin({...});
    $plugin->register_importer({
        name => 'Name of the format which will appear in dropdown',
        key => 'importer_key_which_will_differentiate_it_from_others',
        code => \&Package::method_which_do_import,
        options => [ 'options', 'to', 'receive' ],
        options_template => 'template name' or \&template_code of options,
        options_param => \&Package::method_to_populate_param,
    });

The subroutine referenced by the "code" key takes the following parameters.

    {
        Iter => iterator of streams of files to be imported
        Blog => reference to the blog object which accepts imports
        Callback => subroutine reference used to report progress
        Encoding => specified encoding method for files
        ImportAs or ParentAuthor => reference to author object
        NewAuthorPassword => default password for newly created authors
        DefaultCategoryID => default category id to be used
        key => value, other options 
    }

The subroutine referenced by the "options_param" key takes the following parameters.

    blog_id: blog's id which is importing data.

The subroutine should return a reference to a hash which contains paramters passed to template upon building html.

AUTHOR & COPYRIGHT

Please see "AUTHOR & COPYRIGHT" in MT.

<<