⧼vector-jumptocontent⧽

Instructions for local plugins: Difference between revisions

From EPrints Documentation
new page
 
mNo edit summary
Line 12: Line 12:
  package EPrints::Plugin::Screen::MyItems;
  package EPrints::Plugin::Screen::MyItems;
  @ISA = qw/ EPrints::Plugin::Screen::Items /;
  @ISA = qw/ EPrints::Plugin::Screen::Items /;
 
  use strict;
  use strict;
   
   

Revision as of 11:01, 18 October 2010

To change the functionality of a core plugin within a specific archive, you can make a subclass of the original package.

Make a directory (in this example I'm subclassing a Screen plugin):

~/archives/ARCHIVEID/cfg/plugins/EPrints/Plugins/Screen

copy the original plugin to this location, with a new name:

cp ~/perl_lib/EPrints/Plugin/Screen/Items.pm ~/archives/ARCHIVEID/cfg/plugins/EPrints/Plugins/Screen/MyItems.pm

From the file, remove any subs that you don't need, and rename the package according to the name of the new file (in this example, I'm only redefining the 'render' sub). The file should look a bit like this:

package EPrints::Plugin::Screen::MyItems;
@ISA = qw/ EPrints::Plugin::Screen::Items /;

use strict;

sub render
{
    my( $self ) = @_;
    my $session = $self->{session};
...
...
} #end of sub render