Difference between revisions of "Accessing Metdata Fields"

From EPrints Documentation
Jump to: navigation, search
(Created page with 'This page proves an overview of the API calls you can use to access the data in a DataObj. The example framing this is that of an export plugin. == The Plugin == An export plu…')
 
(redirect to corrected typo page)
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page proves an overview of the API calls you can use to access the data in a DataObj.  The example framing this is that of an export plugin.
+
#REDIRECT [[Accessing Metadata Fields]]
 
 
== The Plugin ==
 
 
 
An export plugin will look something like this:
 
 
 
<source lang="perl">
 
package EPrints::Plugin::Export::Text;
 
 
 
use EPrints::Plugin::Export::TextFile;
 
 
 
@ISA = ( "EPrints::Plugin::Export::TextFile" );
 
 
 
use strict;
 
 
 
sub new
 
{
 
        my( $class, %opts ) = @_;
 
 
 
        my $self = $class->SUPER::new( %opts );
 
 
 
        $self->{name} = "ASCII Citation";
 
        $self->{accept} = [ 'dataobj/eprint', 'list/eprint' ];
 
        $self->{visible} = "all";
 
 
 
        return $self;
 
}
 
 
 
 
 
sub output_dataobj
 
{
 
        my( $plugin, $dataobj ) = @_;
 
 
 
        my $cite = $dataobj->render_citation;
 
 
 
        return EPrints::Utils::tree_to_utf8( $cite )."\n\n";
 
}
 
 
 
1;
 
</source>
 

Latest revision as of 13:37, 3 June 2016